Category filter

Script to hide the Sleep option from the Start menu on Windows

In Windows devices, the ability to customize user settings and manage system options is critical for IT admins seeking to optimize their users’ productivity and system efficiency. This doc provides scripts that will help the administrator customize the Start menu on Windows by hiding/unhiding the Sleep option. Hiding the Sleep option from the Start menu prevents the users from putting the device to sleep deliberately using the Windows Start menu. Later, if you choose to unhide the Sleep option on the Start menu, you may perform that as well. You can employ the Execute Custom Script action to execute these customized scripts across the devices.

Disclaimer:

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

PowerShell script

Hide Sleep option from the Start menu

Use the following script to hide the Sleep option on Windows devices.

The Set-ItemProperty cmdlet is used to modify the registry value “HideSleep” to 1 on a Windows device in the following registry path:

HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start

The registry key “HideSleep” specifies whether the Sleep option is hidden in the Start menu.

Unhide Sleep option from the Start menu

Use the following script to unhide the Sleep option on Windows devices.

Similar to the above script, if the “HideSleep” registry value is set to 0, it unhides the Sleep option from the Start menu.

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.

  • Sample Script Repository