Category filter

Script to restart Windows 10 devices

As organizations become more application-centric, corporate devices will need to handle more applications over time. Unfortunately, using more applications can lead to extended use of the Random Access Memory (RAM), which can degrade device performance. Restarting a Windows device clears the device’s RAM and improves its performance. Device restart also initiates the installation of pending OS updates and software patches on the device. Additionally, restarting the device can be used as a troubleshooting option. Admins can use Hexnode UEM to deploy a custom script that will restart a remote device after a set period.


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Batch Script

Restart device

Replace <time delay> with an integer indicating the delay time in seconds before the system restarts.

Execute the script below to restart the device immediately.

Display warning message before restart

Substitute <message> with the warning message to be displayed on the system as a popup before the device restarts.

Powershell Script

Schedule Device Restart

To schedule restart on a Windows device, run the following script:

The script triggers ($Trigger) an action ($Action) at a specific time and frequency set by the user. The Action is a script restart.ps1, which the user must save on the device and contains the command to restart the device.

The scheduler script will use the path of restart.ps1 provided by the user as $ScriptPath to trigger the restart action with the highest privilege.

The user must provide the script path to restart.ps1, frequency to run the script (Once, Daily, Weekly etc) and the specific time to execute the scheduler script.


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository