Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

My first Monad Script

Posted on February 3, 2006August 5, 2009

Monad Script Screen Shot
I've started testing the waters with the latest build of MSH/Monad. There is of course a nascent Monad script hub at the Technet Script Center. I took inspiration from there and came up with a quick shell script to display services in on the local system. Services that are running are displayed in Green and stopped services display as Red. The script displays the Caption and ServiceName; results are sorted by Caption which is very easy to do in Monad.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

The screen shot gives you and idea of the final result.

I plan on doing much more with Monad and MSH in the coming months so I hope you'll keep my bookmarked or added to your RSS feed. (Add http://jdhitsolutions.blogspot.com/atom.xml to your RSS subscriptions)

# ShowServices.msh
# stopped services will display in RED

# running services will display in GREEN
$strComputer="."

$colItems=get-wmiobject -class "Win32_Service" -namespace ` "root\CIMV2"
-computername $strComputer | sort "Caption" `
| write-object

foreach ($objItem in $colItems) {

if ($objItem.State -eq "Running") {
write-host $objItem.Caption "("$objItem.Name")" `
-foregroundcolor "green" }

else {write-host $objItem.Caption "("$objItem.Name")" ` -foregroundcolor "red" }
}
# End Script


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d