So I am working on rebooting a remote computer. Psexec is not installed on the remote machine so my usual cmds won't work. After tinkering a while I was able to get the reboot to go through by using:
runas /netonly /user:DOMAIN\USERNAME "shutdown -m \\XXX.XXX.XXX.XXX -r -f -t 0"
That works just fine about 99% of the time the issue being that the cmd window that it spawns closes immediately upon execution so there is no chance to see the error code that it returns.
I understand using cmd /k, pause, pinging 127 etc can all be using to hold open local cmd windows, but what can I do to keep a remote window open.
You can execute several commands remotely:
runas ..... "cmd /c shutdown ........ & pause"
runas ..... "cmd /c shutdown ........ & if errorlevel 1 pause"