With Hyena is it possible to do a silent MSI installation on a remote machine.
Announcement
Collapse
No announcement yet.
Remote MSI installation
Collapse
X
-
Re: Remote MSI installation
I believe that you can do with using WMI, if you have either the evaluation copy of Hyena or an Enterprise License. You would right click on a computer, select WMI->Create Process and enter your parameters. It must be a non-interactive process for this to work, however.Kevin Stanush
SystemTools Software Inc.
-
-
Re: Remote MSI installation
I've recently been a patching fool (since WSUS and SMS aren't cutting the mustard alone).
Here's a script I use, and just plug in the appropriate path and name of an MSI file, and away it goes. Works for most properly packaged MSI files.
' --------- start here -----------
'================================================= =========================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.0
'
' NAME: ASP.NET Canonicalization Vulnerability Update.vbs
'
' AUTHOR: DOIM, Fort Eustis , U.S. Army
' DATE : 11/16/2005
'
' COMMENT: Installs the ASP.NET Canonicalization Vulnerability Update
'
'================================================= =========================
Option Explicit
On Error Resume Next
Dim strComputer, strMapDrive, objSoftware, errReturn, objMSIFile
Dim strMSIFileDesc : strMSIFileDesc = "ASP.NET Canonicalization Vulnerability Update"
Dim strMSIFilePath : strMSIFilePath = "\\Server\Updates\asp.net"
Dim strMSIFileName : strMSIFileName = "VPModule.msi"
' --- collect the argument sent ------------------
If WScript.Arguments.Count <1 Then
' --- collect the argument from the user ------------------
strComputer = InputBox ("Enter the name of the target computer on which to run this update/fix/program." & vbCrLf & vbCrLf & _
"YOU CANNOT RUN THIS FIX ON THIS MACHINE!! SO CHANGE THE NAME!!!" & vbCrLf & vbCrLf & _
"Also note: Admin Rights (on the target computer) are required to run this script.", strMSIFileDesc, WshNetwork.ComputerName, 400,400)
If strComputer = "" Then WScript.Quit
Else
' --- collect the argument from the script/cmd line -------
strComputer = UCASE(Trim(WScript.Arguments(0)))
End If
Const wbemImpersonationLevelDelegate = 3
Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
Dim WshNetwork : Set WshNetwork = WScript.CreateObject("WScript.Network")
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim objWbemLocator : Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Dim objConnection : Set objConnection = objwbemLocator.ConnectServer (strComputer, "root\cimv2", , , , "kerberos:" & strComputer)
If Err.Number <> 0 Then
WshShell.Popup "Error connecting to remote system." & VbCrLf & VbCrLf & Err.Number & vbTab & Err.Description,10,"WMI Connection error"
WScript.Quit
End If
CopyMSIFile
objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate
Set objSoftware = objConnection.Get("Win32_Product")
errReturn = objSoftware.Install("c:" & strMSIFileName,,True)
If errReturn = 0 Then WshShell.Popup "Package install of " & strMSIFileName & " is complete for " & strComputer & ".",5,"Package install complete"
RemoveMSIFile
'================================================= =================================================
' --- copy the vpmodule.msi to the remote system
'================================================= =================================================
'
Sub CopyMSIFile
Dim strMSIFile
strMSIFile = strMSIFilePath & strMSIFileName
If fso.FileExists(strMSIFile) Then ' verify the install/patch/update file exists on the server
Set objMSIFile = fso.GetFile (strMSIFile)
On Error Resume Next
strMapDrive = GetNextDrive()
'WshNetwork.RemoveNetworkDrive(strMapDrive & ":")
WScript.Sleep 1000
WshNetwork.MapNetworkDrive strMapDrive & ":", "\" & strComputer & "\C$"
If Err.Number <> 0 Then
WshShell.Popup Err.Number & ". There was an error mapping drive " & strMapDrive & " to " & strComputer & ". The most likely " & _
"cause of this error is that the Administrative shares on the machine (i.e.: " & _
"C$, Admin$) have been altered. Check the remote system to ensure the Admin " & _
"shares are available. Also, ensure this drive isn't already statically mapped on your local system." & vbCrLf & vbCrLf & _
"If the Remote Shares are not available, run the ""Restore Admin Shares"" tool.", 0, "Check the Administrative Shares", vbOkOnly + vbCritical
WScript.Quit
End If
objMSIFile.Copy strMapDrive & ":", True 'Overwrite if it exists
Else
WshShell.Popup "There was an problem verifying the existance installation file." & vbCrLf & vbCrLf & _
"Filename: " & UCASE(strMSIFile) & VbCrLf & vbCrLf & _
"Please check your network connections, or rights to the parent server.", 0, "Error getting installation file", vbOkOnly + vbCritical
wscript.quit
End If
Set objMSIFile = Nothing
End Sub
'================================================= =================================================
'================================================= =================================================
' --- remove the vpmodule.msi from the remote system
'================================================= =================================================
'
Sub RemoveMSIFile
Dim objMSIFile : Set objMSIFile = fso.GetFile (strMapDrive & ":" & strMSIFileName)
objMSIFile.Delete
WshNetwork.RemoveNetworkDrive(strMapDrive & ":")
Set objMSIFile = Nothing
End Sub
'================================================= =================================================
' --- Get the next available local drive to map
'================================================= =================================================
Function GetNextDrive
Dim strAvailable, objDrive
' returns next available drive letter for mapping
' possible drive letters; we leave out A, and B because
' they are not mappable for some clients.
strAvailable = "CDEFGHIJKLMNOPQRSTUVWXYZ"
For Each objDrive In fso.drives
strAvailable = Replace(strAvailable, objDrive.DriveLetter, "")
Next
GetNextDrive = left(strAvailable, 1)
'WScript.Echo GetNextDrive
End Function
'================================================= =================================================
' -------- end here ---------
Hope this helps!
Joel
Comment
-
-
Re: Remote MSI installation
Great topic, thanks for the tips! Here's what I ended up using. Easy to modify and use for other .msi installs.
cmd C:\My_Tools\pstools\psexec \\%E% -u %P1:UserID% -p %P2:Password/PWD% msiexec /i "\\server\share\folder\install_file.msi" /qb & pause
Comment
-
Comment