PSEXEC - "The Handle is invalid" When running the command as System User

bill picture bill · Dec 1, 2012 · Viewed 57.4k times · Source

This is the command that works fine if run from a user-spawned command prompt:

PSEXEC \\xxx.xxx.xxx.xxx -u xxxx -p xxxx -accepteula cmd /c "TYPE C:\Pyxislog\PYXIS01.log|Find/i "%ID%"" >nul

However, if I try to run this from a system-invoked cmd prompt I get this:

Couldn't access 10.219.149.65:
The handle is invalid.
Connecting to 10.219.149.65...

It has to run as a system user, since it will be deployed via a remote software tool which runs as a system user. Is this a limitation of psexec? and yes, the Username and password have administrative rights.

Answer

bill picture bill · Apr 18, 2013

After much research, it is a windows security feature to block all network access to the system user, which includes running tasks as another user. The best method I have found to circumvent this , is to create a scheduled task to run psexec from an administrator account.