Re: PsExec: How to specify session value for the '-i' option?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello Edwin,

ThanQ very much for your answer:

On Jul 30, 5:00 pm, "Edwin vMierlo [MVP]"
<EdwinvMie...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
session name is captured in the variable "SESSIONNAME" on computers which
have RDP enabled

log on to your machine on the actual consol (physical console)
type on the command line "set s" the you see something like this
SESSIONNAME=Console

now log on to your machine using RDP, do the same command
you now see something like this
SESSIONNAME=RDP-Tcp#1

Well, this is new to me. I haven't notice this environment variable
before. I did, how ever, found the session name you are referring to
in the "Terminal Services Manager" program ( I did that before sending
the question group).

But when I enter this value, it doesn't work.

For example, after running this command:
PsExec \\<RemoteServerName> -e -n 5 -i RDP-Tcp#3 notepad.exe

I get:
PsExec could not start RDP-Tcp#3 on REMOTE:
The system cannot find the file specified.

That why I tend to believe that 'session' should be a numerical value.
If I use "0" as the session, notepad is being run in the Console (the
default). But is I use '1':

PsExec \\<RemoteServerName> -e -n 5 -i 1 notepad.exe

I get:
PsExec could not start notepad.exe on REMOTE:
The parameter is incorrect.

(I also tried 2 and 3).

So I have no idea where the problem is and what PsExec is expecting as
the value of '-i'.

Thanks,

Jonathan



you session name changes when you are using RDP, so if you want to execute
the command in a different session you can do that by specifying the -i
switch

HTH,
Edwin.

"JonathanOrlev" <JonathanOr...@xxxxxxxxx> wrote in message

news:1185802179.351802.115690@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hello everybody,

I have a question about the PsExec program, which I could not find
answer to by searching Google.

The question is about the '-i' command-line option:

At PsExec's page (http://www.microsoft.com/technet/sysinternals/
utilities/psexec.mspx), the '-i' option is described as:

In the syntax:
"
[-i [session]]
"

And in the explanations:
"
Run the program so that it interacts with the desktop of the specified
session on the remote system. If no session is specified the process
runs in the console session.
"

So, my question is this: What is this session name? Is it a number? a
string? What is it?

I have Windows 2003 Server installed. I am logged in locally, and also
using Remote Desktop session.

While I can use the '-i' option to interactively run a GUI program
(Notepad for example) locally (the console?) by not specifying the
session, I do not know how can I make the program run interactively on
the Remote Desktop session. I can make a program run interactively on
a given Remote Desktop session on a given computer by specifying the
correct session value/name/number, but I do not know how to do that.

Does anybody have an idea?

Thanks for any reply,

Jonathan


.



Relevant Pages

  • Re: WTSQuerySessionInformation
    ... Session zero has stopped being `the console session` starting from Vista. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Console monitoring via Remote Desktop for Administration.
    ... Are you sure you issued "qwinsta" command from session which was started ... The "mstsc /console" command will let you connect to the console session for ... The "mstsc /console" should let you connect to console session. ...
    (microsoft.public.windows.terminal_services)
  • Re: WTSQuerySessionInformation
    ... Yes we agree that if the console is in the middle of changing ownership then it's not clear what I should do. ... the Terminal Services console session. ... then either I'm running on the physical console and a normal user or other ... This page doesn't single out Windows Vista. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: 2.4.10-r1 MTRR bug
    ... > console is frozen from further output (but it doesn't prevent the full ... > Linux/X session, but not able to regain any virtual console session.) ... 0000:00:02.7 Multimedia audio controller: Silicon Integrated Systems ...
    (Linux-Kernel)
  • Re: Remote Desktop to XP Pro Problems
    ... "console" shouldn't matter much one way or another (Vista and Longhorn ... reserve the console session, session 0, for services; ... behavior of RDP sessions set in the Terminal Services portion of GP? ... There are numerous other ways to shutdown ...
    (microsoft.public.windows.terminal_services)