Wednesday, October 17, 2012
EZ Powershell Services Monitor
# EZ Service Monitor
# By Nigel Glenwood
$myserviceName = "Adaptive Brightness"
$objectServices = get-service -Computername localhost | Where-Object {$_.DisplayName -eq $myserviceName} | Select Name, Status, DisplayName
$objectServices | ForEach-Object {
write-host Server Name $Servername
write-host The NAME of Service is $_.Name
write-host The Status of Service is $_.Status
write-host The displayname $_.DisplayName
if ($_.Status -eq "Stopped")
{
write-host "Warning The Service is Stopped " -BackgroundColor Red
}
elseif ($_.Status -eq "Running")
{
write-host "The service is jogging and running healthy it is in good shape" -BackgroundColor Green
}
}
Friday, September 21, 2012
Split
$tempresult = $Subject[$i].Substring(3,50)
# get rid of first 3 CN=
$tempresult.split(":")
Friday, March 9, 2012
Converting commands easily to nice XML
# Retrieve all hot fixes and output into standard XML type file test.xml
(Get-hotfix ConvertTo-XML).Save("C:\temp\Test.xml")
(Get-hotfix ConvertTo-XML).Save("C:\temp\Test.xml")
Subscribe to:
Comments (Atom)