I always have to go hunting around for this, so thought I might as well post. In a lab on hyper-v, I often console onto the VM’s and don’t want them locking all the time. The lock because the windows power plan “turns off the display” which causes them to go into a locked state. If the VM’s are domain joined you can use group policy to stop the display ever “turning off”.
After virtual machines update: