3

Steps to reproduce:

- Login to a Windows 2008 R2 via RDP
- Open a "Command Prompt"
- Type: qwinsta
- Get:
    SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
    services                                    0  Disc
    console                                     1  Conn
   >rdp-tcp#0         Administrator             2  Active  rdpwd
    rdp-tcp                                 65536  Listen
- Type: tscon 1 /v
- Get:
    Connecting sessionID 1 to sessionname RDP-Tcp#0
    Could not connect sessionID 1 to this session, Error code 5023
    Error [5023]:The group or resource is not in the correct state to perform the re
    quested operation.
- Type: logoff
- Get disconnected from the Server
- Connect again to the Machine via RDP
- Open a "Command Prompt"
- Type: qwinsta
- Get:
    SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
    services                                    0  Disc
   >rdp-tcp#0         Administrator             1  Active  rdpwd
    console                                     3  Conn
    rdp-tcp                                 65536  Listen
- Type: shutdown -r
- Get a Restart
- Wait and reconnect via RDP
- Open a "Command Prompt"
- Type: qwinsta
- Get:
    SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
    services                                    0  Disc
    console                                     1  Conn
   >rdp-tcp#0         Administrator             2  Active  rdpwd
    rdp-tcp                                 65536  Listen

The first qwinsta give me the consoleat Session ID 1 and the Administrator (RDP) at Session ID 2. After I executed the tscon 1 /v Command and logged out an logged in again I got a Session ID 2for the console and a Session ID 1 for the Adminsitrator (RDP). If I then reboot all the Sessions are back to 1for the console and to 2for the RDP. The Question: How can I set console to Session ID 2 and Administrator (RDP) to Session ID 1 permanently ?

Unfortunately I can not automate that. I am using PSExec in a Jenkins Environment. For that I still need to configure WIndows 2008 in that way that it uses ID 1 for the Administrator and 2 for the Console.

Solution:

If you enable the Autologin for the Administrator it still works as expected.

- Activate "Auto Login" for the Administrator
  - Regedit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  - AutoAdminLogon=1
- Command Prompt: control userpasswords2
  - Activate "User must enter a user name and password to use this computer."
  - Deactivate "User must enter a user name and password to use this computer."
  - Click OK
  - Enter Password two times
  - Click OK
  - Restart Machine
Dirk Schiller
  • 131
  • 1
  • 4
  • Unfortunately I can not automate that. I am using PSExec in a Jenkins Environment. For that I still need to configure WIndows 2008 in that way that it uses ID `1` for the Administrator and `2` for the Console. – Dirk Schiller Mar 20 '17 at 09:07
  • Did not test it but what if you connect to the server with `/admin` parameter? `mstsc /v:servername /admin` – duenni Mar 20 '17 at 10:35
  • Duenni, in the end I am using Jenkins and PSEXEC to connect to the Machine so it's not possible to use `/admin`. Thanks a lot ! – Dirk Schiller Mar 21 '17 at 11:44

0 Answers0