IBM Prerequisite Scanner User Manual page 59

Table of Contents

Advertisement

4. Add the code to obtain the value for the prerequisite property by using
VBScript COM and functions to access elements of the Windows environment.
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 the available disk space for the installation directory for a product.
For example, to check for Tivoli Monitoring for Energy Management Reporting
and Optimization by using the "getValue()" on page 132 sub routine, where the
prerequisite property is InstallDir:
Set wshShell = WScript.CreateObject("WScript.Shell")
'Check the disk space for the installation path that is passed as
the value for the PATH argument
installPath = Wscript.Arguments(0)
sInstallPath= "InstallDir="
Wscript.Echo "installation path
set fso = CreateObject("Scripting.FileSystemObject")
getValue fso, sInstallPath, installPath
'Common sub routine
Sub getValue(fso, sKey, drvPath)
Wscript.Echo "getValue(" & skey & "," & drvPath & ")"
If fso.driveExists(fso.getDriveName(drvPath)) then
Set disk = fso.GetDrive(fso.getDriveName(drvPath))
'Value returned is in bytes. Convert to MB
cSize = CLng((disk.FreeSpace/1024)/1024) & "MB"
WScript.Echo sKey & cSize
Else
Wscript.Echo " Disk for " & sKey & " -> " & drvPath & " does NOT exist"
End If
End Sub
5. Run the VBScript collector to ensure that there are no runtime errors and debug
as necessary.
6. Create a batch file to call the VBScript collector. The batch file must have the
same name as the configuration file and a .bat extension,
product_code[_version].bat, as follows:
@echo off
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs
cscript.exe //nologo collector_file_name.vbs %CMD_LINE_ARGS%
7. Create a custom evaluator only if the standard compare functions cannot
compare the actual and expected values.
: " & installPath
Chapter 3. Extending Prerequisite Scanner
49

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

Subscribe to Our Youtube Channel

Table of Contents