Running an MSI file on a remote machine
I have a script that checks remote computers for the latest update for
a software package. If the update is not on the computer, I want the
script to record the comptuer name to a file, and then copy a MSI file
to the computer, then execute that MSI file in quiet mode. I'm having
trouble because every time the script runs, it reinstalls the update on
my local machine and not the remote machine. Pertinent part of the
script is as follows:
Else
Myfile =
"\\ServerShare\ProgramFolder\Upgraded.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set textstream = fso.OpenTextFile(myFile, 8, True)
Textstream.WriteLine("**********************")
Textstream.WriteLine("ComputerName: " &
strComputer)
Textstream.Close
src = "\\ServerShare\ProgramFolder\File.msi"
dest = "\\"& strComputer
&"\C$\VViewer2003.msi"
fso.copyfile src, dest, true
Set objShell =
CreateObject("WScript.Shell")
cmd = "cmd /c psexec C:\VViewer2003.msi"
objShell.Run cmd, 1, True
Any help would be greatly appriciated!
RE: Running an MSI file on a remote machine
Here is a Microsoft Article on how to install MSI packages remotely on remote
computers. It also includes a sample example code:
http://www.microsoft.com/technet/scr....mspx?mfr=true
Re: Running an MSI file on a remote machine
That helped tremendously, but for some reason, I can't get it to
install unless someone with administrative rights is logged in. How
can I set the impersonation level to administrative mode, or is there a
way to supply a domain administrative username and password to do the
install?
Keep in mind I'm very new and very green yet at scripting.
Re: Running an MSI file on a remote machine
Here is the script modified to run under alternate credentials...
'------------------------------------
strComputer = "test-pc"
strUser = "Admin user Name"
strPassword = "Admin password" ' you may want to read value of password
rather than hardcoding it.
'like, use this to read admin user's password:
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()
strDomain = "your domain"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer,
"root\cimv2", strUser, strPassword, "MS_409", "ntlmdomain:" + strDomain)
Set objSoftware = objSWbemServices.Get("Win32_Product")
errReturn = objSoftware.Install("c:\scripts\database.msi",,True)
Wscript.Echo errReturn
'-------------------------------------
--
Re: Running an MSI file on a remote machine
Should this script work if the program to be installed is located on a
computer other than the one where you are trying to do the install?
I tried your script and I can only seem to get it to work when the
program is copied to the remote PC. I am trying to install from a UNC
path on a remote server but am getting back Error 1619.
The article from MS says that this should be possible if you enable
delegation which I have done, but still seem to get the same response.
Re: Running an MSI file on a remote machine