/build/static/layout/Breadcrumb_cap_w.png

PsExec - "system cannot find the path specified"

Bit of background first, then the question, which I've also asked on the Sysinternals forum but as of yet haven't received any responses. Hoping the community here may have a solution or at least suggestions.

At my company we have an SCCM web console that support staff can access for certain tasks, one of which is to check SCCM client health on one of our PCs. 

The code that runs the web console is an ASP page with a bunch of vbscript. The code for the client health check is a vbscript that lives on a server and runs in conjunction with an XML file that provides values for a number of constants.

The code for the client health check looks like this:

Sub ClientHealth_OnClick
   Dim CompName, WshShell, strCommandLine
   CompName = Trim(document.frmMain.txtValue.value)
   Set WshShell = CreateObject("WScript.Shell")    strCommandLine = "psexec -s cscript.exe \\blah\scripts$\SCCM\ClientHealth.vbs /config:\\blah\scripts$\SCCM\ClientHealth.xml"    WshShell.Run (strCommandLine)
End Sub 

Running the code from the web console produced a mysterious error, so I tried running the same code from a command window and received the error "Couldn't access blah\scripts$\SCCM\ClientHealth.vbs: The system cannot find the path specified".

The script in question lives in a folder that Everyone has read/write/execute access to, and the System account has Full Control of.

In testing, I've tried running the same command from my own PC and get the same error message. Also, if I remove the psexec part of the command and run the code below, it works fine:

cscript.exe \\blah\scripts$\SCCM\ClientHealth.vbs /config:\\blah\scripts$\SCCM\ClientHealth.xml

So my hunch is either I can't do what I'm trying to do with psexec, or else I have the language for the command wrong.

We have both XP and Windows 7 PCs in our environment. Currently I've limited my testing to the XP machines since they're the majority.


0 Comments   [ + ] Show comments

Answers (5)

Posted by: Arminius 12 years ago
Second Degree Green Belt
2

Psexec runs as system.  Unless the system space on the local machine has rights to that share, it won't be found.  I get around this by launching psexec, mapping a drive to what I want run using my user credentials, then running the command from the mapped drive. 


Comments:
  • You are probably on to something here,We use a script to create CMD's with the pstools call them but we are on the server. When we use pstools we are loogged into the server doing the calls from the server and attaching to the machines with credentials. - SMal.tmcc 12 years ago
  • You can create a special share and give "everyone" read rights then you would not need any credentials to see the files at all. - SMal.tmcc 12 years ago
Posted by: darkhawktman 12 years ago
Green Belt
1

Whenever I have ran psexec in the past I have had to use the -u and -p commands to add the user name and password with valid credentials. Even though everyone and the system account has access maybe you need to specify a user name and password.


Comments:
  • Just noticed that -s specifies the system account. I noticed that you don't have the computer name in the psexec command line that the command runs on. - darkhawktman 12 years ago
  • The command runs locally on the server where the web console source code is, which is why I'm not specifying a computer name before cscript.exe. - RonW 12 years ago
  • Maybe you need quotes around the cscript.exe command so something like this: psexec -s "cscript.exe \\blah\scripts$\SCCM\ClientHealth.vbs /config:\\blah\scripts$\SCCM\ClientHealth.xml" - darkhawktman 12 years ago
Posted by: SMal.tmcc 12 years ago
Red Belt
1

Try putting the files on a share that is not hidden (no $)


Comments:
  • also is psexec in a directory that is in the search path? You do not show putting a c:\..\...\pxexec just psexec - SMal.tmcc 12 years ago
Posted by: hrs2cool 12 years ago
Black Belt
1

As far as i have seen any executables running with system priveleges will not be able to access Unc path shares. Even when we are testing packaged apps in system account, we copy it locally and then run it. Try running it any other account apart for system account

 


Comments:
  • You can create a special share and give "everyone" read rights then you would not need any credentials to see the files at all. - SMal.tmcc 12 years ago
Posted by: RonW 12 years ago
Green Belt
0

Okay, I've finally got back to this task. I'm now copying the VBS and XML files to the target PC, then attempting to run the script via psexec.
So here's my new command line:

strCommandLine = "[path]\psexec.exe \\" & CompName & " -s -w C:\ClientHealth C:\Windows\system32\cscript.exe C:\ClientHealth\ConfigMgrStartup.vbs /config:\C:\ClientHealth\ConfigMgrStartup.xml"


Everything else from the code in my original post is the same.

Running this still results in "The system cannot find the file specified".

If I log onto the server where the ASP code resides, I can open a command prompt at that location, run the psexec command, and it works fine.

As a test, I changed the "-s" parameter to -u -p and used my username and password. Got the "The system cannot find the file specified" error when I tried running it via the ASP page, but when I run that command on the server, from the same directory where the ASP file is, it works fine.

Any ideas on what else I can try, other than scrap the whole psexec idea and try something different?

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ