Sysinternals Homepage
Forum Home Forum Home > Sysinternals Utilities > PsTools
  New Posts New Posts RSS Feed - PsExec & -i To Interact w/Desktop
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PsExec & -i To Interact w/Desktop

 Post Reply Post Reply Page  <1 234
Author
Message
VitasLoWang View Drop Down
Newbie
Newbie


Joined: 27 December 2008
Location: Czech Republic
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote VitasLoWang Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2011 at 10:59am
I think the problem may be the session number. I noticed that everything in Windows XP runs under session 0 while on my Windows 7 it is different and some processes run under session 0 and explorer.exe and it's children run under session 1.

Use process explorer and check session in view /select columns to check this.
Then you have to use psexec -i sessionnum according to session in which explorer.exe is running to have a visible window if I understand it right...
Back to Top
MagicAndre1981 View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 January 2007
Location: Germany
Status: Offline
Points: 3443
Post Options Post Options   Thanks (0) Thanks(0)   Quote MagicAndre1981 Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2011 at 5:27pm
Originally posted by VitasLoWang VitasLoWang wrote:

I think the problem may be the session number. I noticed that everything in Windows XP runs under session 0 while on my Windows 7 it is different and some processes run under session 0 and explorer.exe and it's children run under session 1.


This is known as Session 0 Isolation and was implemented in Vista first.
Back to Top
Valli View Drop Down
Newbie
Newbie


Joined: 20 October 2011
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Valli Quote  Post ReplyReply Direct Link To This Post Posted: 20 October 2011 at 1:03pm
My Problem is Similar this topic - PsExec & -i To Interact w/Desktop

I am trying to launch a child GUI process from Tomcat service.
It worked in Windows XP when I checked "Allow service interact with desktop"
This didn't help in windows server 2003. ( I am not in that machine I am accessing it using remote connection from Ubuntu system)
I tried using different tool like RunAs, CPAU, RunAsSpc and finally trying with PsExec. And I hope to find solution with this.

Here is the command I am trying
PsExec \\SERVER7 -i -d "C:\Program Files\Apache Software Foundation\Tomcat
6.0\Tool\system\Tool.exe"
This launches the tool if I give in command prompt.
But When I try from web based application running in tomcat it is failing. In the task list I can see Tool.exe
(Note: Using Runtime.getRuntime().exec(<Command>) in java
But Not able to see the UI.
It is possible to make work using PsExec.
It will be really great if I get any help.




Back to Top
GScully View Drop Down
Newbie
Newbie
Avatar

Joined: 25 April 2013
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote GScully Quote  Post ReplyReply Direct Link To This Post Posted: 10 August 2013 at 1:08am
Get the session id of the logged in user, use the $id after the /i option

$command = {cmd /c query user administrator}
$c = Invoke-Command -ComputerName $updateSystem -ScriptBlock $command -cred $credential
$id = $c[1].Substring(43,1)
$id = [uint16]$id

this works well on Windows 2008 r2 and Windows 7
Back to Top
Rithin View Drop Down
Newbie
Newbie


Joined: 29 September 2015
Location: Bangfalore
Status: Offline
Points: 6
Post Options Post Options   Thanks (1) Thanks(1)   Quote Rithin Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2015 at 8:28am
if you want to see GUI for PSExec,  first from the taskmanager check the user Tab and see what is your session ID  with respect to  that you need to change your script .

in script after your password add  -i 2 -d C:\Windows\Notepad.exe( here 2 is my session ID for my command )

Thanks
RM
Back to Top
BI_77 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2017
Location: USA
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote BI_77 Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2017 at 9:20pm
Originally posted by Rithin Rithin wrote:

if you want to see GUI for PSExec,  first from the taskmanager check the user Tab and see what is your session ID  with respect to  that you need to change your script .

in script after your password add  -i 2 -d C:\Windows\Notepad.exe( here 2 is my session ID for my command )

Thanks
RM

That was itWink

a couple of notes: 
-you need to have an interactive session open either in RDP or physically logged in to the machine.
-you need to have the username and password in the command otherwise the GUI you are trying to launch malfunctions. I tried to open wordpad without specifying username and password, and the gui was unusable
-you need to specify the domain in the username parameterie  "-u domain\username"

here's a working command with fake credentials

 psexec \\Mycomp -u mydomain\myusername -p mypassword  -i 2 -d  "C:\Program Files\Windows NT\Accessories\wordpad.exe" 

"When going through hell, keep going"
Back to Top
DontLookAtMe View Drop Down
Newbie
Newbie
Avatar

Joined: 05 December 2017
Location: Czech Republic
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote DontLookAtMe Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2017 at 7:12am
Finally I've found how to run GUI in Remote Desktop! Thx for this topic.

Sorry if its annoying opening few months old thread but..

I'm facing with problem, that Session ID of remote desktop is changing dynamically after every new login. I've read many threads, articles on the web and it's sad to know that I can't fixed Session ID for specific user.

What I want to do?
It's Simple. Just run batch file on my Terminal Server which execute automation over this station.

But because my tests including tests of GUI application, I need to know the Session ID before I exec the PsExec command.

Do you have any ideas how to "hack" this?
Back to Top
 Post Reply Post Reply Page  <1 234
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.06
Copyright ©2001-2016 Web Wiz Ltd.