PA . VBScript.
script .
vb script, , :
SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
"IBM WebSphere MQ" "DisplayName". , " ". , " " ... script. . , ..........
'------------------------------------------------------------------------------------
'Script Name : listMQ.vbs
'Author : Akshay Sinha
'Created : 05/10/12
'Description : This Script attempts to check if the correct version of Websphere MQ is already installed on the system.
' : If found the Script will exit with a ERRORLEVEL of 0.
' : If found but not of correct version... Script will exit with a
' ERRORLEVEL of 1..Which in turn will initiate a Uninstalation
' : If not found, Script will exit with a ERRORLEVEL of 2 and initiate a
' a fresh installation.
' : Syntax: at command prompt ->
' : C:>Cscript listMQ.vbs
' : Check the value of %ERRORLEVEL% after execution.
' : C:>echo %ERRORLEVEL%. Should give 0,1 or 2
'------------------------------------------------------------------------------------
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "."
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry1c = "DisplayVersion"
strEntry1d = "UninstallString"
Set objReg = GetObject("winmgmts:
objReg.EnumKey HKLM, strKey, arrSubkeys
WScript.Echo "Installed Applications" & VbCrLf
intVersionNum="1.0.0.0"
For Each strSubkey In arrSubkeys
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strEntry1a, strValue1)
if intRet1 <> "" Then
objReg.GetExpandedStringValue HKLM, strKey & strSubkey, strEntry1a, strValue1
intCompare=StrComp("IBM WebSphere MQ",strValue1,vbTextCompare)
IF intCompare = 0 THEN
objReg.GetExpandedStringValue HKLM, strKey & strSubkey, strEntry1c, intVersionNum
strUninstall=strSubkey
WScript.Echo "Congratulations!! Websphere MQ is already installed on this system"
WScript.Echo strEntry1a & " : " & strValue1
WScript.Echo strEntry1c & " : " & intVersionNum
END IF
End If
Next
IF intVersionNum="1.0.0.0" THEN
WScript.Echo "Sorry Websphere MQ was not found on this system"
WScript.Quit 2
END IF
intVersionCompare=StrComp("7.0.1.5",intVersionNum,vbTextCompare)
IF intVersionCompare = 0 THEN
WScript.Echo "Congratulations!! Correct version of Websphere MQ is installed"
WScript.Echo "Uninstall String for this product is : " & strUninstall
WScript.Quit 0
ELSE
WScript.Echo "Wrong Version of MQ installed"
WScript.Echo "Initiating Unistallation....."
WScript.Quit 1
END IF
script.. , , .