
To shut down or the power off button helps to remove power from a computer’s main components in a controlled way. After a computer is shut down, main components such as CPUs, RAM modules, and hard disk drives are powered down, although some internal components, such as an internal clock, may retain power. The shutdown command can be executed within a command shell in windows “shutdown.exe” and it is located in %windir%\System32\shutdown.exe. Kindly refer to these related guides: How to use command prompt to shutdown and restart your computer, Unable to Shutdown a HyperV Virtual Machine, how to logoff, restart, or shutdown Windows PC or Server remotely via Command Prompt and PowerShell, and how to disable the Windows welcome screen and shutdown screen.
The following steps below are ways to prevent users from shutting down virtual machines.
Launch group policy editor and navigate to the following path.
- Local Computer Registry
- Computer Configuration
- Administrative Templates
- Start Menu and Taskbar
Search for “Remove and Prevent access to shutdown, restart, Sleep and Hibernate command.

The result would be as shown below when you click on the power button to initiate a shutdown.

To take effect immediately, ensure to enter gpupdate /force
from the command line interface (CMD).
Furthermore, I hope you found this blog post on how to prevent users from shutting down in a Virtual Machine helpful. Please let me know in the comment session if you have any questions.