question

Erik-1761 avatar image
0 Votes"
Erik-1761 asked

Run psexec in shutdown script fails with access denied

Hello,

When I shutdown my system (guest), I would like to run a program on a different computer (host) remotely. For that purpose, I have written a small batch file which executes some command on the host using psexec like this:

psexec -d -u user -p password \\192.168.1.2 c:\mepath\somebatch.bat

or even
psexec -d -s \\192.168.1.2 c:\mepath\somebatch.bat

This works fine as long as I run it locally on the host PC in an elevated command prompt.

However, if I add this call to the shutdown script of the guest, the psexec job is not executed. The reason is obviously because the programs run in shutdown script use the local system account rther than a local administrator account to run. So I have tried to simulate the behaviour by opening a console window on the host, logon as system user (using psexec -i -s cmd.exe on the host which gives me a command prompt running as a local system account), and when I then try to execute the above psexec statement I receive the following error:

Couldn't access 192.168.1.2
"access denied"


So my very simple question is: how can I run a script that starts a remote process in shutdown script. Or to put it another way: how can I make psexec to work when it is run locally under the system user account? Or is there any way to elevate from system user to another Administrator user (as far as I know, runas won't work in system user context either).

Any ideas how to perform this?

windows-sysinternals-pstools
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers