PsExec doesn’t have path

nantpathpstoolswindows-server-2008

I have a brand new windows 2008 server (64 bit), and the remote deployment scripts using nant and psExec are not behaving like they do on the old servers.

This works: psExec \\newserver.myco.com cmd
This successfully runs Nant: psexec \\newserver.myco.com "C:\Program Files (x86)\Nant\Nant.exe"
Ok, it doesn't do anything meaningful with nant, but it shows that nant.exe does in fact run.
But this does not run:
psexec \\newserver.myco.com Nant or
psexec \\newserver.myco.com Nant.exe or
psexec \\newserver.myco.com "Nant.exe"

I get:

PsExec could not start Nant.exe on newserver.myco.com :  
The system cannot find the file specified.

this works fine on the other servers, which run Server 2003, also 64 bit.

I can verify that Nant is on the path on newServer:

C:\>path  
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;"C:\Program Files (x86)\nant" 

And if I type "nant" in a command window on that machine, I get nant's output.
The path and nant is present and correct even if I get in via psexec cmd.

What's up with the path over psexec on 2008?

Best Answer

Looking at the Process Monitor results its a mangled filepath so the path variable is messed up. Remove the double quotes from "C:\Program Files(x86)\nant", if you look at the one result it shows the quotes are getting embedded directly into the filepath.

You don't need double quotes in a PATH variable, its the semi-colons that mark where things are rather than spaces.

I do not know if you have to add a trailing backslash (C:\Program Files(x86)\nant\ ) or not, try it both ways.

I so love sysinternals