Windows 7..10: disable shutdown/hibernate/sleep/restart from UI
Posted by jpluimers on 2019/02/18
I needed this for the Windows 10 machine of my mentally retarded brother: WoL (wake-on LAN) for his machine always works when it is in sleep or deep sleep mode, not every now and then fails when fully powered off.
After it is disabled in the UI, you can still perform it with [WayBack] shutdown.exe, so I added these shortcuts first:
shutdown /r /t 0for “reboot”shutdown /h /ffor “sleep” (note: this does not accept/t 0as it is implied)
for Windows versions not supporting this switch, you can try [WayBack] PsShutdown – Windows Sysinternals | Microsoft Docs
Do not ever callPowerProf.dllfromrundll32.exe(thanks [WayBack] grawity for pointing that out in [WayBack] windows 7 – Sleep shortcut in win7 – Super User)psshutdown.exe -d -t 0(Suspend)psshutdown.exe -h -t 0(Hibernate)psshutdown.exe -s -t 0(Shutdown without poweroff)psshutdown.exe -d -t 0(Poweroff)
Disabling the Shutdown related actions in the UI consists of two steps:
- Removing it from the logon screen using the registry
- Removing it from the user using
gpedit.msc(which is wrapped inmmc.exe)
I will try to get the registry changes for the second using [WayBack] RegFromApp – Generate RegEdit .reg file from Registry changes made by application (thanks [WayBack] magicandre1981 for suggesting that at [WayBack] windows – How can I use Process Monitor to detect register changes made by GPEdit modifications? – Super User).
The wrappingmmc.exeis easiest to obtain using Process Explorer, and RegFromApp likely needs to run in elevated mode.If that fails, I can try Process Monitor as suggested by [WayBack] Tom Wijsman in [WayBack] command line – Change group policy using windows CMD – Super User.
The reason for the above is that I want to avoid UI based modifications that are hard to script.
Remove Shutdown options from the logon screen
This is just the registry setting below.
It also removes the reboot/hibernate/sleep options from the logon screen, so you need shortcuts for that.
Remove Shutdown for the regular users UI
This can be done using either gpedit.msc (Group Policy Editor) drilling down to the local policies or secpol.msc (the Local Policy Editor):
- Drill down to
Local PoliciesUser Rights Management
- Double click
Shut down the system - Remove the groups you don’t want the system to shutdown
- Press
OKto confirm
See the video below how.
I’ve removed the group Users and kept the group Administrators to allow ShutDown.
Administrators now do need to execute the above commands (for instance
shutdown.exe /h /f) in with an UAC administrative token enabled!If you do not want that, add the users that can perform Shutdown commands to a new group, then aadd that group to
Shutdown the system.
If you want to perform this system wide for all users, then it’s faster to change the [WayBack] Windows Explorer NoClose policy (see also [WayBack] Group Policy Registry Reference).
Icons
For the shutdown shortcuts, I’ve used these icons in %SystemRoot%\System32\shell32.dll:
Editing he policies
–jeroen
References: Windows 7..10: disable shutdown/hibernate/sleep/restart from UI.
Gist:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Windows Registry Editor Version 5.00 | |
| [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] | |
| "shutdownwithoutlogon"=dword:00000000 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shutdown /r /t 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shutdown /h /f |






Leave a comment