Tell me if you’ve heard this one before. You build a bunch of new VMs for your lab environment. You have them all running but every time you switch back to a VM you find that it’s always locked and you have to press Control-Alt-Delete and enter your password. In a production environment, this is a great behavior but in a home lab it is maddening. I finally sat down to try and fix this and it turns out it seems pretty simple. Simply add the following two lines to your deployment script:
powercfg -change -monitor-timeout-ac 0
powercfg -change -standby-timeout-ac 0
What these commands do is change the following two properties (Turn off the display and Put the computer to sleep) for the currently active PowerPlan and sets them to Never.