Execute command on remote computer and show UI to logged on user

pstoolsremote-accesswindows-server-2012-r2

since I could not find any proper solution online, I'll ask here.

I have a bunch of computers where I want to execute a program and show the programs GUI to the currently logged in user. Afaik this is not possible with Powershell (Stop/Start of Windows Services is no problem) and I could not manage to get this done with PsExec.exe.

My PsExec command looks like this – calc.exe is visible in the TaskManager but I can't see the GUI.

C:\Users\Administrator.DEV\Desktop>PsExec.exe -i \\TEST-CLI-01 -u localUser -p userPassword -d calc.exe

Short Setup description:
Server: MS Server2012R2
Clients: Windows 8.1
Every System is part of the AD Domain.

Anyone has an Idea how I could achieve this ?

Thx a lot in advance 🙂

Best Answer

You're going to find this to be exceedingly difficult, if not impossible, to do. You would think it would be easy, but it isn't. Microsoft has made this purposefully difficult because it exposes a type of security vulnerability ("shatter" attacks) if you can manipulate the window manager in another user's security context.

The Session 0 Isolation feature, introduced in Windows Vista, makes it difficult for a service program (like PsExec) to interact with the console. When the Interactive Services Detection service is running the user will be prompted, when a service attempts to interact with the console, to switch to a secure desktop to interact with the service's GUI.

There's some discussion on Stackoverflow that gets down into the details of the architecture a bit.

A better way to handle this would be to have the user run a process that listens for some type of interprocess communication and acts accordingly. If you wanted to get really, really hackish you could run a simple VBScript or Powershell script that sat in the background, when the user logged-on, and waited for a file / registry entry / TCP connection / etc and then took action. You could cobble something like that together as a proof-of-concept pretty quickly.