windows - VBScript and PSEXEC - Remotely Executing Application -


i updating existing hta application. page displays records of each machine in company hasn't performed backup (via ibm tsm) within last 3 days. have made button each record when pressed, should execute cscript process using psexec run exe on target machine , passes argument. (dsmc.exe incremental) can manually open cmd prompt, use \remote cmd command create remote cmd, , run application fine. without step of creating remote cmd prompt, , trying

psexec \\remotemachine cscript.exe "c:\program files\tivoli\tsm\baclient\dsmc.exe" incremental 

only results in error. know should possible remotely execute program , still pass in argument doesn't run. , when create remote cmd prompt using

psexec \\remotemachine cmd 

any other lines in execution script not execute until exit remote cmd prompt.

is there secret psexec don't understand or way grab existing cmd prompt (the remote 1 created) , pass command execute? please help

*note, not first script using psexec. typically use vbscript create batch file locally psexec script contained, , execute it. never have been able wsshell.run work psexec.

here (more or less) syntax using objshell.run work psexec:

set objshell = createobject("wscript.shell")
objshell.run "cmd.exe /c ""%pathtopsexec%\psexec.exe"" -accepteula -s -i -d \\remotemachine cmd.exe /k ipconfig",0,true

this example, shows can send nested switches, etc. it's important understand switches of psexec.

-accepteula - accepts license agreement on psexec. isn't necessary unless you're running first time , want quiet.
-s - runs system account of remote computer. if don't use this, need specify -u , -p if want run interactively. otherwise credentials perform network logon
-i - specifies run interactively. can omitted or session can specified.
-d - don't wait remote command finish before moving on


Comments