# Script to hide Restart option in Windows 10/11 devices

In case the organization wants to prevent accidental restarts of their company devices by their employees, Windows offers a provision in the Registry editor to hide the Restart option. IT admins can simplify this process by running a script on the Windows 10/11 device to hide the Restart option from the Start Menu, the Windows sign-in screen, and the ALT+CTRL+DEL screen. Hexnode UEM allows IT admins to remotely deploy these scripts to the endpoints using the [Execute Custom Script](https://www.hexnode.com/mobile-device-management/help/executing-custom-scripts-for-windows/) action.

 Disclaimer: 
The sample scripts provided below are adapted from third-party open-source sites.

 

Batch script
------------

### Hide Restart option

Batch script to hide Restart option

REG ADD "HKLM\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" /v "HideRestart" /t REG\_DWORD /d 1 /f 

   1

  REG ADD "HKLM\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" /v "HideRestart" /t REG\_DWORD /d 1 /f 

   

 

  

Updating the data of registry option “`HideRestart`” present under `HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\Start` in the Registry Editor to `1` hides the Restart option in the device. `/f` is used to force the overwriting of the existing entry without prompting.

### Re-enable Restart option

Batch script to re-enable Restart option

REG ADD "HKLM\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" /v "HideRestart" /t REG\_DWORD /d 0 /f 

   1

  REG ADD "HKLM\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" /v "HideRestart" /t REG\_DWORD /d 0 /f 

   

 

  

Changing the value assigned to registry option “`HideRestart`” back to `0` brings back the Restart option in the device.

PowerShell script
-----------------

### Hide Restart option

PowerShell script to hide Restart option

Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" -Name "HideRestart" -Value 1 -Force 

   1

  Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" -Name "HideRestart" -Value 1 -Force 

   

 

  

The script uses the `Set-ItemProperty` cmdlet to change the value of the registry option “`HideRestart`” to `1`, thus removing the Restart option from the Start Menu, Windows sign-in screen, and ALT+CTRL+DEL screen.

### Re-enable Restart option

PowerShell script to re-enable Restart option

Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" -Name "HideRestart" -Value 0 -Force 

   1

  Set-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Start" -Name "HideRestart" -Value 0 -Force 

   

 

  

Setting the `–Value` parameter back to `0` in the previous script re-enables the Restart option in the device.

 Notes:- 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.