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:
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)
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.
Community Chosen Answer
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.