3

I've reached the limit of my knowledge about PSExec; I'm working with a software stack that uses it to kick off some batch files and perl scripts on remote machines, but something's wrong with one of the machines and we're not sure what to try. I'm getting the following:

PsExec could not start explorer.exe on [machine name redacted]:

The system cannot find the file specified.

when running the following command:

psexec -i -u [username redacted] -p [password redacted] \[machine name redacted] explorer.exe C:\TestAutomation\RunScript.pl

That command works on other machines, so it's a machine problem, almost certainly with the target machine (since I can run the same command targeting a different machine and it works fine). If I remote desktop into the target machine, I can run the following command:

explorer.exe C:\TestAutomation\RunScript.pl

And it works fine. I have C:\Windows shared as ADMIN$. If I remote desktop into the machine, I get "No process is on the other end of the pipe", which seems to be a common issue with PSExec not understanding RDP; if I run a net use command first (which is what our normal software stack does), however, I go back to getting the above error.

Where do I go from here in my troubleshooting process?

ETA:

C:>psexec -i -u [username redacted] -p [password redacted] \[machine name redacted] C:\Windows\explorer.exe C:\TestAutomation\RunScript.pl

has the exact same result (cannot find file)

C:>psexec -i -u [username redacted] -p [password redacted] \[machine name redacted] ping [second machine name redacted]

works just fine.

C:>psexec -i -u [username redacted] -p [password redacted] \[machine name redacted] C:\Windows\explorer C:\TestAutomation\RunScript.pl

gets me

PsExec could not start C:\Windows\explorer on [machine name redacted]:

Access is denied.

while

C:>psexec -i -u [username redacted] -p [password redacted] \[machine name redacted] explorer C:\TestAutomation\RunScript.pl

gets me

PsExec could not start explorer on [machine name redacted]:

The system cannot find the file specified.

So I'm wondering if I don't have multiple problems? A path issue and an access issue? The username I'm using is an administrator on the remote machine.

6
  • What is the command line's working directory when you run it in remote desktop? Commented Mar 14, 2013 at 13:33
  • @AJHenderson C:\Documents and Settings\[username], it's just where I happened to have a terminal open Commented Mar 14, 2013 at 13:34
  • 1
    is "launch folder windows in a separate process" checked in the machines Explorer -> Tools -> Options -> View settings? I've noticed that psexec needs that setting enabled to launch a new explorer process. Commented Mar 14, 2013 at 13:39
  • How about if you epecify Explorer's path? Something like: psexec -i -u [username] -p [password] \\[machine] %windir%\system32\explorer.exe C:\TestAutomation\RunScript.pl Commented Mar 14, 2013 at 13:44
  • @FrankThomas Those settings seem to be folder-specific, which folder needs that set? C:\Windows or C:\TestAutomation? Commented Mar 14, 2013 at 14:24

2 Answers 2

2

psexec does not search the targets computer PATH variable for executables. and (correct me if im wrong) as far as i know i does not resolve environment variables.

so you simply need to specify the full path to the file you want to run. in your case use

C:\Windows\explorer.exe

instead of

explorer.exe

like in techie007s example but without the %windir% (also system32 is wrong):

psexec -i -u [username redacted] -p [password redacted] \[machine name redacted] C:\Windows\explorer.exe C:\TestAutomation\RunScript.pl
6
  • PsExec could not start C:\Windows\explorer.exe on [machine name redacted]: The system cannot find the file specified. Commented Mar 14, 2013 at 14:22
  • i just tried the command and it worked for me, the explorer gets started on my target machine. could you please post the complete command you typed and the full respone? btw are you trying to run a perl script? in that case you should use the perl.exe and not the explorer
    – weberik
    Commented Mar 14, 2013 at 15:14
  • I did post the complete command in my question. The only part of the response I omitted was the copyright notice. We have these machines set up to be able to execute perl scripts from explorer and I can do so from the command line on the target machine, as I stated in the question. Commented Mar 14, 2013 at 15:22
  • Furthermore, as I stated in the question, it works just fine on a different machine. There's something wrong with the target machine. So your being able to get it working doesn't actually help either, since obviously your machine is configured correctly wherever mine isn't. Commented Mar 14, 2013 at 15:23
  • oh sorry, somehow i overlooked the first part of the question. i had some trouble with differing psexec client/server versions in the past, mybe your are affected by that too. when you connect to a pc with psexec for the first time, psexec installs a server on the target machine. you could try to delete/stop(do a quick google for instructions) that service and retry
    – weberik
    Commented Mar 14, 2013 at 15:41
-1

It was a permissions issue. I'd checked the permissions on C:\Windows a half dozen times, but I finally checked the permissions on C:\Windows\explorer.exe and noticed they were different. Adding group "Everyone" with permission "Full Control" lets PsExec run just fine. Despite having specific error messages for permissions issues, PsExec decided to go with file not found in this instance for some unknown reason.

1
  • 2
    Good you found a solution. So you know, explorer.exe doesn't usually have 'everyone' permissions; instead, try removing those and ensuring 'users' have 'read & execute'. When running PSEXEC make sure you have admin rights on the remote host. Also, you could try workaround to instantiating explorer.exe - replace it with cmd.exe. Great for scripts.
    – Lizz
    Commented Mar 21, 2013 at 3:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .