Skip to content
Menu

Service Stopped - Monitor

Alerts when any service you name is not running. Wildcards work, manual services do not alert by default, and the run skips when no named service is found.

Service stopped - monitor is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Service stopped - monitor. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, Windows Server 2016+; runs as SYSTEM or a user
NeedsPowerShell 5.1
Read-onlyReads, changes nothing

What It Does

The script looks up each service in Names, by service name or display name with * and ? as wildcards, writes one row per service found, and alerts when any of them is not running.

With OnlyAutomatic, on by default, a service whose start type is Manual or Disabled is shown but never alerts, because those are meant to be stopped most of the time. A service that is set to Automatic but only starts when something triggers it will alert, so leave those out of Names.

A name that matches no service is a warning. When none of the names match anything on the PC the result is skipped because none of the service names matched. The repair twin is restart-service.

Before You Run It

  • Use service names where you can. Display names change between versions.
  • Leave trigger-start services out of Names, or they will alert while idle.
  • Schedule it on the machines that run the software. On the others it only skips.

Type and Risk

  • Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: Under 10 seconds.
  • Example answer: "1 service(s) not running: Spooler (Stopped)"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • Names: Services to watch, separated by commas, e.g. "Spooler, MSSQLSERVER". Service names or display names; wildcards work. Required.
  • OnlyAutomatic: true to alert only for services whose start type is Automatic (including delayed start). Default true.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

test-service-running.ps1 · 787 lines · 39.3 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.