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.
PowerShell script
Hide Sleep option from the Start menu
Use the following script to hide the Sleep option on Windows devices.
1 2 |
$path= "HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start" Set-ItemProperty -Path $path -Name 'HideSleep' -Value 1 |
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.
1 2 |
$path= "HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start" Set-ItemProperty -Path $path -Name 'HideSleep' -Value 0 |
Similar to the above script, if the “HideSleep” registry value is set to 0, it unhides the Sleep option from the Start menu.