# Psexec action fails, psexec manually works

**URL:** https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354
**Category:** Discussion
**Created:** [October 20, 2009, 9:59am UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354 "2009-10-20T09:59:54Z")
**Posts on this page:** 6
**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: [October 20, 2009, 9:59am UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354/1 "2009-10-20T09:59:54Z")

</div>

I have psexec set up to call iisreset /stop on a web server.&nbsp; If I use the psexec action in finalbuilder, it returns error code 87.&nbsp; If I copy and paste the parameters logged for this action into a command prompt to call psexec manually, it works fine.&nbsp; I have tried it with a few other programs and I get an error as well, but different return code.

Any ideas what can cause this?&nbsp;&nbsp;The psexec action works fine on my machine but not on my build machine.&nbsp; Also I have checked and the pstools directory is set properly in FB options.

Here is the output from the psexec action in FB:

Command line : psexec \\webserver -u domain\Administrator -p "\*PASSWORD\*" -accepteula iisreset /STOP  
Return code : 87  
Action Failed.  
&nbsp;

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 20, 2009, 10:43am UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354/2 "2009-10-20T10:43:49Z")

</div>

Hi Eric   
  
 I’m not able to reproduce this here. What version of pstools and windows and FinalBuilder are you using… and can you post the full output of the psexec action?

---

<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: [October 20, 2009, 10:51am UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354/3 "2009-10-20T10:51:42Z")

</div>

I am using psexec v1.96 (I downloaded it today). Finalbuilder 6.3.0.1712. Win 2003. I am using this setup for my own machine and it works fine. Same set up on my build machine where its failing.   
  
 Unfortunately, that is the whole output from psexec action.   
  
 I will look at some things on my end, I must have something configured incorrectly on my build machine. But its strange that calling psexec manually works with the same params.

---

<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: [October 22, 2009, 3:38am UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354/4 "2009-10-22T03:38:47Z")

</div>

Here is an error I found on the web server (target machine). Do you know of any differences in the psexec action vs. calling psexec manually? I am not familiar with where the file path below is coming from, but it has FB in it, so maybe its something finalbuilder is doing that calling psexec manually isn’t? BTW, I did check component services and dcom is enabled and connection protocols are there as well.   
  
 Event Type: Error   
 Event Source: DCOM   
 Event Category: None   
 Event ID: 10009   
 Date: 10/22/2009   
 Time: 11:26:01 AM   
 User: N/A   
 Computer: WEBSERVER   
 Description:   
 DCOM was unable to communicate with the computer **Settings\Temp\1\FB\_PSExec\_radC6714.tmp** using any of the configured protocols.   
  
 For more information, see Help and Support Center at [http://go.microsoft.com/fwlink/events.asp](http://go.microsoft.com/fwlink/events.asp).

---

<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: [October 23, 2009, 12:41pm UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354/5 "2009-10-23T12:41:09Z")

</div>

I have narrowed down the cause of psexec action failing to be the redirection of standard output and standard error to finalbuilder. If I uncheck these 2 options in the psexec action, it executes fine and returns error code 0.   
  
 Can you shed some light on how FB is redirecting the console output to finalbuilder? I must have some windows policy or other setting on my build machine that is preventing this from working. Any insight would be appreciated.   
  
 Thanks

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 25, 2009, 11:57am UTC](https://www.finalbuilder.com/forums/t/psexec-action-fails-psexec-manually-works/1354/6 "2009-10-25T11:57:44Z")

</div>

Hi Eric   
  
 We do have to jump through hoops to redirect the output of psexec. The reason that a bug psexec makes redirection difficult. What we do is actually run cmd.exe and have it execute psexec and it does the redirection of stdout and stderror.   
  
 One thing that might be a possible cause is if your TEMP environment variable has been overriden. Make sure you have not defined a variable with that name (this causes all sorts of problems for all sorts of programs).
