If I connect to an office PC with Remote Desktop (Terminal Services) I can see in Powershell that I have an RDP session:
PS E:\> QWINSTA
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
>rdp-tcp#13 berndw 2 Active
console 4 Conn
rdp-tcp 65537 Listen
But I can see the console session is available. I know it is because I can log in to the same PC using VNC and see that I'm logged into a console session:
PS E:\> QWINSTA
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
>console berndw 2 Active
rdp-tcp 65537 Listen
Nothing has changed, all my windows are still open, even the powershell window I ran QWINSTA in, and I can move to RDP again and the windows are still there and I can move back to VNC and they are still there, that is, user context survives this switch from a terminal services session to a console session back and forth.
Fantastic. And?
Well, I would like, while logged in with RDP to run a windows application in the console session! I'd be happy to respond to a login prompt to do the session switch, if needed. Is that even possible? And if so how could it be done? Is there some way in Powershell to make this request, to use Start-Process
say to start a process that starts in the Console terminal (happy to switch back once it's started).
There is a way indeed to do this. It runs like this:
- Close my RDP client
- Connect with VNC client
- Login
- Connect with VNC client again
- Start-Process myapp
- Close VNC
- Connect with RDP client
Why is this not good enough? Because its extremely slow to do, and frustrating as all heck.
Step 4 is interesting and I should explain, but am keen to learn too. What apparently happens is that in step 3, when I log in, Windows (Windows 10 in my case) notices a terminal Services session (RDP) closes that and opens a Console session, and in this switcheroo the Ultra VNC server on the host disconnects. So I have to reconnect and when I do, I see my windows as they were (all happily moved from the RDP session to the Console sessions). Then when I close the VNC client and connect with RDP again all my windows again survive just fine.
So why do all this? I'll admit that is not relevant to the question of how, but to satisfy your curiosity, the reason is simple enough and relates some software I need to use which only starts properly in a console session, but VNC is patently unusable (it's far too slow, and I believe throttled on top of that by a firewall the host is behind in an effort to discourage use, and encourage RDP use - I have no control over this, it is simply the case that RDP is like I was there at my PC and VNC takes seconds to echo keystrokes and 10s of seconds to render the desktop - as I said, no control over this, not within my sphere of influence).
So at present I am stuck with a frustrating time consuming process to start this app. If I could somehow run it from the RDP session but in the console session that would make all this go away. Even if that logs me out of RDP and I have to log back in again, it is less time consuming and less frustrating than the current VNC solution. And no, nor can I use Teamviewer, LogMeIn or Nomachine or anything else that connects to a console session - again not in my control (only RDP and VNC are supported/permitted)