Required Files: None
Monitor multiple important services from a single script on a standard server. Notify if any of them are stopped.
Import-Module $env:SyncroModule <# .SYNOPSIS Monitors the status of an array of services .DESCRIPTION Checks the status of each service, and optionally creates a Syncro alert if it was not running. #> <# Set options below: $alertSyncro = $true / $false : Set to $true to create an alert in Syncro $alertCategory = "my_alert_category" : category of RMM alert generated in Syncro $services = "Netlogon", "Spooler" : The array of services you want to check #> $alertCategory = "services" $notify = $true $services = "epag", "DcomLaunch", "MSDTC", "gpsvc", "Netlogon", "Spooler", "TermService", "RpcSs", "SamSs", "LanmanServer", "SENS", "Schedule", "ProfSvc", "EventLog", "Winmgmt", "LanmanWorkstation" Get-Service -Include $services | Where-Object {$_.Status -eq "Stopped"} | Tee-Object -Variable stoppedServices if($stoppedServices.Count -gt 0) { $notification = $stoppedServices | Format-Table -Property DisplayName | Out-String if($notify) { Rmm-Alert -Category $alertCategory -Body "The following services are stopped `n $($notification)" } } |