Here’s how to prevent a Windows RDP from being accidentally shut down.
- Go to “Local Security Policy”

2. Go to “Local Policies -> User Rights Management”

3. Right-click “Shut down the system” and click properties:

Remove “Users” to prevent non-admin from performing a shutdown, remove administrators to disable shutdown/restart completely:

Restart (or signout) and then sign in again, the user will no longer have the option to shutdown:
