How To: Rebooting a Computer Via Windows Management Instrumentation (WMI) Call

 Originally published on December 03, 2009 by Dirk Paessler
Last updated on March 03, 2022 • 3 minute read

The main task of PRTG Network Monitor is to optimize your network’s availability and performance by avoiding system downtimes. All systems should always be up and running properly. That’s the theory… Still some services fail, even without a complete crash of the server itself.
One of the most common methods of recovery is a reboot of the server to get the failing service back online. In certain cases, it is useful to have this done automatically. PRTG initiates a reboot when it discovers a service that fails for more than 15 minutes for example. Remote reboots can be performed by command lines tools (e.g. from the Sysinternals toolset) or by using a Windows Management Instrumentation (WMI) call. Today I want to share a script that performs remote reboots without any additional software (neither on the client side nor on the server side) and works with every Windows computer that is capable of WMI.
 
If you experience unexpected behavior of a monitored service, you can now restart the computer it is running on, by using PRTG’s “Execute Program” notification in combination with our reboot script. You can individually specify the sensor status which triggers the reboot. Learn how to create and use a reboot VBS script with PRTG in our latest Knowledge Base article: Rebooting a computer via Windows Management Instrumentation (WMI) call.