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 commandline interface (CMD)