PSEXEC - “The Handle is invalid” When running the

2019-06-15 13:41发布

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.

4条回答
Explosion°爆炸
2楼-- · 2019-06-15 14:11

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.

查看更多
成全新的幸福
3楼-- · 2019-06-15 14:20

It might be unrelated, but I actually found I got this "The handle is invalid" error if the connection went down to the machine - i.e. the machine fell asleep.

查看更多
贼婆χ
4楼-- · 2019-06-15 14:21

Psexec forces to use System user account by adding -s parameter.

We use psexec to launch some task in remote computers and it logs in a database table. When we dont use -s parameter user appears as domain\administrator but if you use -s parameter it appears as "System"

For the invalid handle message check this:

https://superuser.com/questions/200938/psexec-the-handle-is-invalid

查看更多
欢心
5楼-- · 2019-06-15 14:24

Have you tried using the -h flag?

from technet: -h If the target system is Vista or higher, has the process run with the account's elevated token, if available.

Full page: https://technet.microsoft.com/en-us/sysinternals/psexec.aspx

查看更多
登录 后发表回答