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

No comments:

Post a Comment