Auto-log-in user at boot without unlocking screen, Windows Server 2012 R2

notneps

Distinguished
Sep 5, 2014
129
0
18,680
When you log into a user on a Windows Server 2012 R2 machine, upon closing the RDP window the user remains logged in, with applications continuing to run, while the display on the machine's monitor shows the lock screen.

What I would like to happen: When the machine boots, user X is automatically logged in in the background (activating all of User X's startup programs, triggering a login with Task Scheduler, etc.), all while only displaying the lock screen.

As of now, I have to RDP into the user from another machine and close the RDP window, (leaving the user logged in and the screen locked) every time I restart the server. What I want is for this to happen automatically on boot.
 
Solution
You could do it in two stages:
1) auto login designated account: suggestions are here http://superuser.com/questions/499724/auto-login-windows-server-2012
2) have a simple script which runs after login to lock the machine. The following works on Win7/8/10, I assume 2012R2 will too.

Make a txt doc and paste in the following:
---
On Error Resume Next

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"
----
Save the file and then change the extensino from .txt to .vbs
Then you should be able to run it immediately after login using task scheduler.

There would be slight window where someone could potentially access the machine and cancel the scheduled task, but if you're...
You could do it in two stages:
1) auto login designated account: suggestions are here http://superuser.com/questions/499724/auto-login-windows-server-2012
2) have a simple script which runs after login to lock the machine. The following works on Win7/8/10, I assume 2012R2 will too.

Make a txt doc and paste in the following:
---
On Error Resume Next

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"
----
Save the file and then change the extensino from .txt to .vbs
Then you should be able to run it immediately after login using task scheduler.

There would be slight window where someone could potentially access the machine and cancel the scheduled task, but if you're happy with that possibility, this solution would work.
 
Solution