Skip to main content

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

  1. Run netplwiz
  2. Uncheck "Users must enter a username and password"
  3. 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

  1. General Tab
    1. Fill out all the things you need
    2. Select "Run only when user is logged on"
    3. Check "Run with highest privileges"
  2. Triggers Tab
    1. New → At login → Specific User (select your auto-logon user)
  3. Actions Tab
    1. New → Start a program (select what you want to run)
  4. Conditions Tab
    1. Uncheck everything here unless you need it
  5. Settings Tab
    1. Check "Allow task to be run on demand"
    2. 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"