Persist User Session when Remoting In
I have a W11 VM running on my home lab that runs some software. The problem with this is each time I remote in, it's using a different session, and that software isn't visible to my session. Here is what I did to get that software to persist across sessions, which is essentially forcing my user to use single session...
Enable Auto Login
I know, I know
- Run
netplwiz
- Uncheck "Users must enter a username and password"
- Set the credentials for the user
This will ensure the software always runs in the same session, and when the VM boots and whatnot, my user is logged in (Session 1)
Create A Scheduled Task
- General Tab
- Fill out all the things you need
- Select "Run only when user is logged on"
- Check "Run with highest privileges"
- Triggers Tab
- New → At login → Specific User (select your auto-logon user)
- Actions Tab
- New → Start a program (select what you want to run)
- Conditions Tab
- Uncheck everything here unless you need it
- Settings Tab
- Check "Allow task to be run on demand"
- Check "Restart task if it fails" or whatever that looks like for you
Always RDP into the SAME Session
To avoid using a different RDP session, enable single session RDP! Run the following in PowerShell (admin priv):
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fSingleSessionPerUser /t REG_DWORD /d 1 /f
Lock Screen After Auto-Login
If you are worried about leaving the VM open, simply create a shortcut in the Startup folder to this:
rundll32.exe user32.dll,LockWorkStation
That will lock the screen right after login, so the software runs, but it's "secure"