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

  • Thread starter Thread starter JonathanOrlev
  • Start date Start date
J

JonathanOrlev

Guest
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
 
Re: PsExec: How to specify session value for the '-i' option?

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

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" <JonathanOrlev@gmail.com> wrote in message
news:1185802179.351802.115690@g4g2000hsf.googlegroups.com...
> 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
>
 
Re: PsExec: How to specify session value for the '-i' option?

Hello Edwin,

ThanQ very much for your answer:

On Jul 30, 5:00 pm, "Edwin vMierlo [MVP]"
<EdwinvMie...@discussions.microsoft.com> 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...@gmail.com> wrote in message
>
> news:1185802179.351802.115690@g4g2000hsf.googlegroups.com...
>
> > 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
 
Back
Top