Fixing the Windows Server 2012 R2 Screen Lock Issue
Working on Windows Server 2012 R2-based computers is a nice experience. The OS is far more stable than anything we’ve known so far — it’s fast, responsive, and if you can teach yourself to ignore the semi-Windows 8 interface, it also has a really good user experience.
I’ve been building and maintaining hundreds of Windows Server 2012 R2 virtual machines in many customized labs that I use for training and testing purposes. Setting up the machines is much easier than any previous Microsoft operating system, and by using PowerShell to automate the deployment tasks, I can get them all up and running real quickly.
But there’s one small thing that I’ve been personally annoyed with.
After logging onto the OS using either the built-in Administrator’s account or any AD-based user account, I’ll use the system and leave it idle for a few moments to walk away to do something on a different machine, where I’m found with the following message:
As you can see, I find that I’m locked out from the server.
On previous operating systems, this timeout was changed by manipulating the screensaver options from Control Panel. However, if you look at the screensaver settings in Windows Server 2012 R2, then you won’t see anything special. In fact, it seems that no screensaver is enabled in the first place:
So, how do you disable this screen locking mechanism?
Note: Disabling this screen locking mechanism and leaving your sessions unlocked is not a good idea for production environments. You do not want to leave the servers in a logged-on and unlocked state, as any user that walks by can use the user session to cause damage. However, in labs and testing environments, especially virtual ones, “walking away” is not a literal thing, you just switch between many running VMs, and you don’t want to have to always have to unlock your idle session, and retype your long password so many times each day. Keep this in mind before changing this on production servers.
The trick is to edit the Group Policy that affects the server(s) and configure the Power Management setting for the screen shutdown timeout.
First, open Group Policy Management from the Administrative Tools folder.
If this is an AD-joined computer, then the easiest way is to create or edit a GPO that’s linked to the OU where the server(s) object is located, or link one to the entire AD domain.
In this case, I edited a GPO called Lab Group Policy Object.
Expand Computer Configuration > Policies > Administrative Templates > System > Power Management > Video and Display Settings.
In the right-pane, click to open the Turn off the display (plugged in) setting.
In the setting window, click on Enabled, then change the value of Turn Off the Display (seconds) to 0 (zero).
Close the Group Policy editor window.
Now, reboot your servers or refresh the GPO by typing the following command:
You can also keep the setting instead of turning it off. Instead of setting it to zero, change it to something like 30 minutes or so, which translates to 1800 seconds.
Now you can switch back and forth between your VMs, and they will not lock themselves out anymore, which will make your life a bit easier.