# How to use PSExec

**URL:** https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743
**Category:** Discussion
**Created:** [April 20, 2011, 10:44am UTC](https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743 "2011-04-20T10:44:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 20, 2011, 10:44am UTC](https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743/1 "2011-04-20T10:44:37Z")

</div>

Hi!

**Background**  
Finalbuilder version 7.0.0.1065 is running on a VMWare Workstation virtual machine with Windows XP.  
The host is Windows Server 2003 R2 SP2 x64. The host has the latest TestComplete 8 installed.  
The reason Testcomplete is installed on the host and not on the guest is that the named license is much cheaper.  
The floating license (that allows running on the guest) for Testcomplete add about 2000 Euro...  
  
**The problem**  
In my script on the guest I want to run TestComplete on the host.  
From the command line this works fine:  
  
"C:\Program Files\PSTools\psexec.exe" \\Attracs\_BM2011 -i 0 -u Attracs2\administrator -p "\*PASSWORD\*" "C:\Documents and Settings\Administrator.ATTRACS2\My Documents\Bats\StartTestComplete.bat"  
&nbsp;

When when I add PSExec action to a FB script and run it the log event look like this:

Command line : psexec \\Attracs\_BM2011 -u Attracs2\administrator -p "\*PASSWORD\*" "C:\Documents and Settings\Administrator.ATTRACS2\My Documents\Bats\StartTestComplete.bat" -i 0  
&nbsp;

On the host I see the process is started in taskmanager but no window is shown and nothing happen.  
I think that the -i parameter is not in right order. It must be before the bat file to execute.  
I attach the PSExec Action if you can see something wrong with it.

Regards

Roland Bengtsson  
Attracs Team

[PSExec.xml](https://www.finalbuilder.com/forums/uploads/default/original/2X/1/1170ee0d6bf594e810def232458045286285b838.xml) (4.915 KB)

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [April 21, 2011, 3:20am UTC](https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743/2 "2011-04-21T03:20:28Z")

</div>

Hi Roland   
  
 The reason that this is not working is because you are passing ‘-i 0’ in the Parameters field in on the Program page of the action. These parameters are the parameters to be passed to the program being executed on the remote machine (in your case StartTestComplete.bat).   
  
 To enable your bat file to interact with the desktop session, enable the ‘Program interacts with remote computer’s desktop screen option’ on the Process Options page of the PsExec action. This will pass the ‘-i’ switch in the correct location.   
  
 Regards,   
 Steve

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 21, 2011, 9:51am UTC](https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743/3 "2011-04-21T09:51:04Z")

</div>

Hi, thanks for the answer!

But it still don't works Here is my current output from the log.

Command line : psexec \\Attracs\_BM2011 -u Attracs2\administrator -p "\*PASSWORD\*" -i "C:\Documents and Settings\Administrator.ATTRACS2\My Documents\Bats\StartTestComplete.bat"   
  
PsExec v1.98 - Execute processes remotely  
Copyright (C) 2001-2010 Mark Russinovich  
Sysinternals - www.sysinternals.com  
  
The parameter is incorrect.  
Connecting to Attracs\_BM2011...  
  
Starting PsExec service on Attracs\_BM2011...  
  
Connecting with PsExec service on Attracs\_BM2011...  
  
Starting C:\Documents and Settings\Administrator.ATTRACS2\My Documents\Bats\StartTestComplete.bat on Attracs\_BM2011...  
  
PsExec could not start C:\Documents and Settings\Administrator.ATTRACS2\My Documents\Bats\StartTestComplete.bat on Attracs\_BM2011:  
Return code : 87  
Action Failed.  
  
As you see there is "-i" after password but i my working example from commandline I use "-i 0" (0 for sessionid).  
So how can I specify sessionid?  
  
Regards  
Roland Bengtsson  
Attracs Team

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [April 27, 2011, 6:39am UTC](https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743/4 "2011-04-27T06:39:09Z")

</div>

Hi Roland   
  
 I have added the option to specify the session id to run the process within when running the process interactively. You will find this option on the Process Options of the PsExec action.   
  
 You can download the build that contains this feature from here:   
 [https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700\_1177.exe](https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700_1177.exe)   
  
 Regards,   
 Steve

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [April 27, 2011, 10:29am UTC](https://www.finalbuilder.com/forums/t/how-to-use-psexec/1743/5 "2011-04-27T10:29:45Z")

</div>

Thanks for the upgrade! It seems to work fine.   
  
 Regards   
  
 Roland Bengtsson   
 Team Attracs
