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.
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