How to prevent users from VM shutdown ? or how to disable or remove shutdown/restart buttons from start menu? You can disable power options in VM template through PowerShell and also using “Local Group Policy Editor”. The users may accidently shutdown their VM and it results in end-user complaints, through these settings you can prevent user initiated shutdowns in VM.

1. PowerShell : Remove Windows shutdown command from Start menu

Open PowerShell and copy paste this command given below and press enter key.

Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HidePowerOptions" -Value 1 -Force

Make sure you run PowerShell as administrator otherwise you will see this error “Set-ItemProperty: Requested registry access is not allowed.

Open PowerShell as administrator, executed the command successfully.

Now “Power Options” are hidden from Start Menu.

How to get the current PowerOptions settings ?

Copy and paste this command to PowerShell and press enter key.

Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HidePowerOptions" 

PowerOptions are hidden if “HidePowerOption” value is showing as 1 (Same as the screenshot given above).

2. How to hide PowerOptions through Local Group Policy Editor ?

GPEDIT Settings: Remove and prevent access to the Shutdown, Restart, Sleep and Hibernate Commands

This policy setting prevents users from performing the following commands from the Windows security screen, the logon screen, and the Start menu: Shut Down, Restart, Sleep, and Hibernate. This policy setting does not prevent users from running Windows-based programs that perform these functions. If you enable this policy setting, the shutdown, restart, sleep, and hibernate commands are removed from the Start menu. The Power button is also removed from the Windows Security screen, which appears when you press CTRL+ALT+DELETE, and from the logon screen. If you disable or do not configure this policy setting, the Power button and the Shut Down, Restart, Sleep, and Hibernate commands are available on the Start menu. The Power button on the Windows Security and logon screens is also available.
  • Go to start menu, type in gpedit, then select “Edit group policy“.
  • Navigate to Computer Configuration -> Administrative Templates -> Start Menu and Taskbar.
  • Double click “Remove and prevent access to the Shutdown, Restart, Sleep and Hibernate Commands” option from the right pane.
GPEDIT - Local Group policy Editor - Remove and prevent access to the Shutdown, Restart, Sleep and Hibernate Commands
GPEDIT Settings: Remove and prevent access to the Shutdown, Restart, Sleep and Hibernate Commands

Now choose “Enabled” option as shown in the screenshot given below and click OK.

GPEDIT - Local Group policy Editor - Remove and prevent access to the Shutdown, Restart, Sleep and Hibernate Commands
GPEDIT Settings: Remove and prevent access to the Shutdown, Restart, Sleep and Hibernate Commands Enabled
Shutdown, Restart, Sleep & Hibernate buttons disabled
Shutdown, Restart, Sleep & Hibernate buttons disabled