Checking the Windows Installer Version for MOM Agent Installation
| MOM 2005 SP1 requires Windows Install 3.1v2. Given a computer name, this script will check the version and report any deficiency. In it's present state, anything below the MOM 2005 SP1 requirement for agent install will return the version difference. If the computer is up to snuff, script ends silently. '========================================================================== ' ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.0 Enterprise ' NAME: MSIv2.vbs ' AUTHOR: Pete Zerger ' DATE : 2/14/2006 ' COMMENT: This script checks to determine if MSI v2 is installed on the machine ' If version is below that defined in strReqVersion (3.1v2 in this script) ' the difference will be reported. If = or >, no output means version is adequate. ' ' SYNTAX: msiv2.vbs ' running without an argument returns syntax. ' works with wscript or cscript '========================================================================== Dim strReqVersion, arrayDesiredVersion, arrayMSIVersion, strCurrentVersion, strFailMessage 'Take target computer name as a command line argument If WScript.Arguments.Count = 1 Then ServerName = WScript.Arguments.Item(0) Else WScript.Echo "missing target servername argument" WScript.Echo "syntax msiv2.vbs Wscript.Quit End If 'Desired version of Windows Installer (3.1v2 for MOM 2005 SP1) strReqVersion = "3.1.4000.2435" 'setting the authentication level in a moniker String Set objWMIService = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & ServerName & "\root\cimv2") Set fso = CreateObject("Scripting.FileSystemObject") sys32folder = fso.GetSpecialFolder(1) strCurrentVersion = fso.GetFileVersion(sys32folder & "\MSI.DLL") Dim strArray arrayDesiredVersion = Split(strReqVersion, "." , -1, 1) arrayMSIVersion = Split(strCurrentVersion, "." , -1, 1) For strArray = 0 to Ubound(arrayDesiredVersion) If arrayMSIVersion(strArray) < arrayDesiredVersion(strArray) Then 'If the version is below that required, raise an error strFailMessage = "MSI below the desired version level." & _ VbCRLF & "Current Version: " & strCurrentVersion & _ VBCRLF & "Required Version: " & strReqVersion& _ VBCRLF & "Target File: " & sys32folder & "\MSI.DLL" WScript.Echo strFailMessage Exit For End If Next |










Comments on "Checking the Windows Installer Version for MOM Agent Installation"
post a comment links to this post