How to create a script to disable the shutdown button on Windows 7

8,099

Solution 1

Windows shut down, restart, sleep and hibernate are controlled by one .exe file: %windir%\system32\shutdown.exe

So as you want to do this from a command line and not a GPO we need to use the only tools we have at our disposal Command Prompt:

icacls %windir%\system32\shutdown.exe /deny SID:D

This will remove their access to the shutdown command and they will not be able to execute a shutdown.

Solution 2

Disable Shutdown, Restart, Sleep, and Hibernate Buttons

To open Local Group Policy Editor, click on Start and type in gpedit.msc and hit Enter.

In Local Group Policy Editor navigate to User Configuration \ Administrative Templates \ Start Menu and Taskbar and double click on Remove and prevent access to the Shut Down, Restart, Sleep, and Hibernate commands.

Now you want to enable this setting and click Apply and Ok. You can leave a note to yourself in the comment box, which I find comes in handy when changing a lot of settings in Group Policy.

Now when you look at the Power options in the Start Menu, the only options available are Log off, Switch user, and Lock.

The setting goes into effect right away for all users of the machine. The button to turn off the computer if the user hits Ctrl+Alt+Del will be gone as well.

Source

Share:
8,099

Related videos on Youtube

Microsofty
Author by

Microsofty

Yes, I really do type with those nails. I can rewire cat5 with them too. ;)

Updated on September 18, 2022

Comments

  • Microsofty
    Microsofty over 1 year

    I want to create a script in command prompt that will permanently remove a user's right to shutdown a machine. I've done it before, but in Windows XP, and many years ago, and I think I did it in Group Policy Editor.

    How do I create a batch script to disable the shutdown button on Windows 7?

    • Canadian Luke
      Canadian Luke over 10 years
      Just to clarify: Do you want to disable a user from being able to shutdown the system no matter what? Or just make the Shutdown button in the Start Menu do something else? Or remove it from the Start menu?