|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
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! |
#2
| |||
| |||
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 |
#3
| |||
| |||
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. |
#4
| |||
| |||
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 '------------------------------------- -- |
#5
| |||
| |||
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. |
#6
| |||
| |||
Thank you so much Umesh. You have been truely invaluable to me! This has been frustrating but fun at the same time, and with your help, you have saved me days of work! When running the install on remote machines, I get install error 1639. Is this related to log in information through the script? I can't find much usefull information online as of yet. |
#7
| |||
| |||
Re: Running an MSI file on a remote machine
You can check this tool |
![]() |
|
Tags: machine, msi file, remote computer, remote machine, script |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Running a batch file from a remote machine in a VB code | Radhu | Software Development | 1 | 14-10-2011 04:54 PM |
Running script on remote machine | SuderMan | Windows Server Help | 12 | 25-08-2010 06:51 PM |
Is it possible to run any .exe in the remote machine using WMI? | Swati_here_2008 | Software Development | 3 | 05-05-2008 06:45 PM |
WMI to remote machine | AndyS | Windows Server Help | 3 | 17-10-2007 07:42 PM |
Execute a BAT File in a remote machine | Juanjillo | Windows Server Help | 4 | 23-02-2007 01:55 PM |