vbscript - Installation of MSI File on remote machine from local machine -
here script install msi file on remote machine:
const msifilename = "\\<ip addr>\c$\mysetup\<filename>" set wshshell = wscript.createobject( "wscript.shell" ) wshshell.run "msiexec /a " & msifilename & " /quiet /log c:\install.log", 1, true
when run script local machine, file installs on machine running from. instead want installed on machine specified in msifilename
. going wrong?
you're running remote msi on local host. install remote executable on remote host, use wmi:
host = "<ip addr>" setup = "msiexec /a ""c:\mysetup\<filename>"" /quiet ..." set wmi = getobject("winmgmts://" & host & "/root/cimv2") rc = wmi.get("win32_process").create(setup, , , pid) if rc = 0 wscript.echo "setup started pid " & pid & "." else wscript.echo "starting setup failed. (" & rc & ")" end if
the above start process asynchronously (i.e. create
returns immediately). if need wait remote process complete, you'll have monitor this:
do wscript.sleep 100 set p = wmi.execquery("select * win32_process processid=" & pid) loop until p.count = 0
there may simpler ways want, though, e.g. psexec
:
psexec \\<ip addr> msiexec /a "c:\mysetup\<filename>" /quiet ...
Comments
Post a Comment