A monitored service has gone down. The server is still up, no crash, no alert storm, just one stubborn service that won't respond. Your fastest path back? A remote reboot, triggered automatically, using tools already built into Windows.
Windows Management Instrumentation (WMI) makes this possible without installing anything on the target machine. No agents, no third-party utilities, just a lightweight script and the right permissions.
In this guide you'll learn:
Windows Management Instrumentation (WMI) is a built-in Windows framework that lets administrators query and control system settings, services, and hardware, locally or across a network. It's been part of Windows since Windows 2000, so it's available on virtually every Windows machine you'll ever manage.
A WMI reboot uses this framework to send a restart command to a remote computer over the network. A few reasons it's worth knowing:
Good use cases for a WMI reboot:
Before running a WMI reboot, make sure these conditions are met on both machines.
On the target machine:
services.msc) and confirm "Windows Management Instrumentation" is set to Automatic.C:\temp folder exists on the target machine. The script writes a log file there. If the folder is missing, the script will fail — sometimes with a misleading "RPC Server unavailable" error. Create it manually before running the script.On your machine (the one running the script):
cscript.exe, no additional runtime needed.If you're using PRTG:
💡 If you're already using PRTG's WMI sensors to monitor Windows machines, your credentials and network access are probably already set up correctly.
The script below is the official Paessler-provided VBS script for remote WMI reboots. It connects to the target machine using explicit credentials, handles errors, and writes a log file to C:\temp\ScriptLog.txt so you can confirm it ran.
The script:
' *************************************************************************
' PRTG CUSTOM EXE Notification - reboots a remote computer via WMI
' *************************************************************************
' Created by Paessler Support Team - open source, no warranty
'
' Set your parameters below, then save as reboot.vbs
On Error Resume Next
strComputer = "MyComputer" ' hostname or IP of the machine to reboot
strDomain = "MyDomain" ' domain name; use "" if not domain-joined
strUser = "MyName" ' admin username on the target machine
strPassword = "MyPassword" ' password for the above account
' *************************************************************************
' Code section - no changes needed below this line
' *************************************************************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\temp\ScriptLog.txt", True)
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _
"root\cimv2", _
strUser, _
strPassword, _
"", _
"ntlmdomain:" + strDomain, _
"128")
If Err.Number <> 0 Then
objFile.WriteLine(Err.Description)
WScript.Quit(Err.Number)
Else
On Error GoTo 0
Set colSwbemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_OperatingSystem")
For Each objSystem in colSwbemObjectSet
objSystem.Reboot
Next
objFile.WriteLine("Success")
WScript.Quit("0")
End If
What each part does:
strComputer: Replace MyComputer with the hostname or IP of the machine you want to reboot.strDomain: Your Windows domain name. If the machine is not domain-joined, use an empty string "".strUser / strPassword: Admin credentials on the target machine. Same credentials you'd use in PRTG for WMI monitoring.ConnectServer: Establishes the authenticated WMI connection to the remote machine.Win32_OperatingSystem: The WMI class that represents the OS. Its Reboot method triggers the restart.C:\temp\ScriptLog.txt on the machine running the script.To run it manually:
strComputer, strDomain, strUser, and strPassword valuesreboot.vbs (when saving in Notepad, wrap the filename in quotes to avoid it saving as .vbs.txt)cscript reboot.vbsC:\temp\ScriptLog.txt to confirm the result📌 For a modified version that reboots multiple servers with configurable delays, see the Paessler Knowledge Base article on WMI reboots.
Running the script manually is useful. But the real value is automating it. PRTG Network Monitor can watch your services around the clock and trigger a reboot the moment something goes wrong, no manual intervention needed.
Step 1: Add the script to PRTG
reboot.vbs in the PRTG notifications folder: C:\Program Files (x86)\PRTG Network Monitor\Notifications\EXEStep 2: Create an "Execute Program" notification
reboot.vbs from the dropdownStep 3: Set your trigger
What happens next:
💡 You can test the whole setup without waiting for a real failure. Right-click the sensor in the device tree and select Simulate Error Status. After the latency period, the reboot will fire.
💡 You can monitor Windows services directly with PRTG's built-in Windows Service sensor. If WMI is already set up, no extra configuration needed.
Note: PRTG always executes notifications from the core server, never from a remote probe. Make sure your core server has network access to the machine you want to reboot.
WMI reboots are reliable once configured. But a few things can trip you up on the first run.
C:\temp folder on the machine running the script. Create it manually and try again.dcomcnfg, go to Component Services > Computers > My Computer > Properties > COM Security, and confirm remote access is allowed.services.msc and confirm "Windows Management Instrumentation" is running and set to Automatic. If it's stopped, start it manually.strComputer. Test basic WMI connectivity first by running wmic /node:"TARGET_NAME" os get caption from a command prompt. Also check C:\temp\ScriptLog.txt for error details.A WMI reboot is one of the more practical things you can add to a Windows monitoring setup. It's built into the OS, nothing to install on either end, and when you connect it to PRTG it turns a service failure into something that just fixes itself.
To recap:
C:\temp\ScriptLog.txtC:\temp folder, permissions, or firewall rules — all straightforward to fixIf you want to monitor your Windows environment and set up automated recovery like this, PRTG has a 30-day free trial with no credit card required.