Fixing a Down Windows Service with Automation

N1-1166-NinjaOne01-screen-dark

As technicians, how often do we get calls, that turn out to be just another crashed service? This used to happen to me a lot in my MSP days. And while it’s an easy manual fix, we could save a ton of time for ourselves and our clients if we could monitor and automatically reboot those services. Read on as I show you how to do just that!

The example I’ll use in this article is the print spooler service because it’s one that we’ve all had to start up again after a crash, at least once or twice. Now, of course, with NinjaOne, you can easily view the services running on a machine. Simply open the device and navigate to Tools>Service Manager, to view a list of all the services on the device and their status.[PB1]  You can even start, stop, or restart them all without ever opening a remote session. That’s pretty cool! Let’s make it even cooler though!

Screenshot of Services Manager

Open up or create a policy to monitor the print spooler on any device with that policy and set up the automation. Go to Administration>Policies>Agent Policies and select the policy you want to use. The policy editor opens to the conditions page by default which is right where you need to be.

To create a new condition, click the “Add a condition” button and you’ll see a new window to build your own condition. Give it a name that describes what the condition is doing. There are a lot of options, but for this article, we’ll focus on just a few of them. You can read even more about conditions on our Dojo Conditions page.

Screenshot of dialog box to add a condition

Once you’ve given the condition a name, it’s time to make some magic! Click the “Select a condition” link right above the condition name. In the dropdown, select “Windows Service” and then, in the next box select a service to monitor. This dropdown is auto populated based on the services installed on any device within your NinjaOne instance, so you should always be able to find what you need. The “State” drop down should default to “Down” which is what you need in this example, so leave that as it is, and then fill in the rest of the options to fit your situation. When using a condition like this on a policy it’s wise to check the “Ignore if service is disabled” and/or the “Ignore if service is manual” boxes so that you don’t receive false alerts for devices set up in either of these conditions. Once you’ve completed this condition setup, click “Apply.”

Pro Tip: You can add multiple services to the same condition.

The next step is to add an automation. Automations are scripts. NinjaOne has a ton of built-in scripts and you can also add your own. Go to our Dojo Custom Scripts page to learn more about adding your own scripts. The Automations section is on the right side of the Conditions window. On the Automations section, click add. For this example, we’ll use the native script for starting and stopping windows services. Search for “Start or Stop – Windows Service” in the search box, and then select the script. This will open a new window where you can select which service(s) to act on, and what action to take. This example uses the print spooler; click “Start Action” then click “Apply.”

The next step is to set an auto reset for “When no longer met” and uncheck the “After X time” box. This is a preference, you can have it reset whenever you like, but we’ve found it helpful to have the condition showing on the device dashboard to let technicians know the service is stopped just in case the script can’t bring it back up for some reason.

You can also set “Channel(s)” to decide if and how to get notifications for this. Visit the Channels Dojo page for more on that, technician notifications, and ticketing rules. Once you have all that set to your organization’s needs, you can click the “Add” button in the bottom right and you’re all done! Below is what our sample looks like.

Next Steps

For MSPs, their choice of RMM is critical to their business success. The core promise of an RMM is to deliver automation, efficiency, and scale so the MSP can grow profitably. NinjaOne has been rated the #1 RMM for 3+ years in a row because of our ability to deliver an a fast, easy-to-use, and powerful platform for MSPs of all sizes.
Learn more about NinjaOne, check out a live tour, or start your free trial of the NinjaOne platform.

You might also like

Ready to become an IT Ninja?

Learn how NinjaOne can help you simplify IT operations.

×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).