Psexec , cmd and batch file

Posted by user311130 on Stack Overflow See other posts from Stack Overflow or by user311130
Published on 2010-05-05T15:39:08Z Indexed on 2010/05/05 15:48 UTC
Read the original article Hit count: 535

Filed under:
|
|

Hello.

I have a batch file named a.bat on a winserver2008 Desktop.

That batch file only write the SessionID (from environment variable) to a local eventlog.

I want to execute it remotely using cmd (otherwise the SessionName doesn't appear).

so I have tried

c:\PsTools\psexec.exe \\<Server> -u test2 -p <Password> -i 2 cmd "c:\Users\test-2\Desktop\a"

or

c:\PsTools\psexec.exe \\<server> -u test2 -p <Password> -i 2 "cmd \"c:\Users\test-2\Desktop\a\"";exit

all of these just open a terminal on the remote machine but don't execute the batch.

Any ides?

Best Regards,

© Stack Overflow or respective owner

Related posts about scripting

Related posts about psexec