IBM Prerequisite Scanner User Manual page 57

Table of Contents

Advertisement

For example, mssqlVersion.vbs contains the code to obtain the actual value for
the MS SQL server prerequisite property on the Windows machine.
2. Using a VBScript editor, add the code to obtain the value for the prerequisite
property. Use VBScript COM and functions to access elements of the Windows
environment and run in the Windows Script Host environment. Ensure the
check returns standard output as follows:
WScript.Echo "property_name=" & var_for_value
v property_name that represents the prerequisite property as written in the
configuration file, for example, env.tcrhome.
v var_for_value, that is, the VBScript variable for the actual value that the
collector obtains for the prerequisite property.
To check whether the TCR_HOME environment exists and return the actual value,
where the prerequisite property name is env.tcrhome:
set wshShell = WScript.CreateObject("WScript.Shell")
tcr_home=WshShell.ExpandEnvironmentStrings("%TCR_HOME%")
WScript.Echo "env.tcrhome=" & tcr_home
To check whether the JRE is set in the PATH variable, where the prerequisite
property name is env.path.jre:
Set wshShell = WScript.CreateObject("WScript.Shell")
path = WshShell.ExpandEnvironmentStrings("%PATH%")
Set objRegEx = new RegExp
objRegEx.Pattern = "(^|([:;\\/]))(C:\Program Files\IBM\Java60\jre\bin)($|[:;])"
objRegEx.IgnoreCase = True
objRegEx.Global = True
Set matches = objRegEx.Execute(path)
WScript.Echo "env.path.jre=" & (matches.Count > 0)
To check the version of Tivoli Directory Integrator installed, where the
prerequisite property name is installedSoftware.TDI.version:
strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
regDisName = "DisplayName"
regDisVer = "DisplayVersion"
Set oReg = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
Set sftReg = new RegExp
sftReg.pattern = "Tivoli Directory Integrator"
sftReg.Global=False
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
searchkey = strKeyPath & "\" & subkey
oReg.GetStringValue HKEY_LOCAL_MACHINE, searchkey, regDisName, strName
oReg.GetStringValue HKEY_LOCAL_MACHINE, searchkey, regDisVer, strVersion
If Not IsNull(strName) Then
Set matches = sftReg.Execute(strName)
If matches.Count > 0 Then
Wscript.Echo "installedSoftware.TDI.version=" & strVersion
End If
End If
Next
3. Run the VBScript collector to ensure that there are no runtime errors and debug
as necessary.
4. Create a custom evaluator only if the standard compare functions cannot
compare the actual and expected values.
Chapter 3. Extending Prerequisite Scanner
47

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Prerequisite Scanner and is the answer not in the manual?

Questions and answers

Table of Contents