I have an a Windows 2016 VM on Azure that several users are RDPing into. The users are complaining that the VM shuts down at random times. When I check the logs, it shows that the shutdown has been initiated by the user! I would like to remove the option of shutting down the VM after RDPing into (remove the shutdown button). How can I achieve this?
To remove the shutdown command, you can connect to the template VM and execute the below PowerShell script.
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HidePowerOptions" -Value 1 -Force
Or, you can choose to follow these manual steps using the template VM:
1.Press the Windows key, type gpedit, then select Edit group policy (Control panel).
2.Go to Computer Configuration > Administrative Templates > Start Menu and Taskbar.
3.Right-click Remove and prevent access to the Shut Down, Restart, Sleep, and Hibernate commands, and click Edit.
4.Select the Enabled setting and then click OK:
5.Notice that the shutdown command no longer appears under Windows Start menu; only the Disconnect command appears.
Please refer link for detailed information :