Profile for WebSphere 7.0 application server on Windows

Microsoft.JEE.WebSphere.7.0.Windows.Profile.Discovery (Discovery)

Discovers WebSphere 7.0 application server profiles on Windows.

Knowledge Base article:

Summary

The profile discovery locates profiles for WebSphere 7.0 application server. After they have been discovered, a monitoring template should be applied to enable monitoring.

Element properties:

TargetMicrosoft.JEE.WebSphere.7.0.Windows.Installation
EnabledTrue
Frequency14400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
Discovered relationships and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Default

Source Code:

<Discovery ID="Microsoft.JEE.WebSphere.7.0.Windows.Profile.Discovery" Target="Microsoft.JEE.WebSphere.7.0.Windows.Installation" Remotable="true" Enabled="true">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.JEE.WebSphere.7.0.Windows.Profile"/>
<DiscoveryRelationship TypeID="Microsoft.JEE.WebSphere.7.0.WindowsComputerContainsProfile.Relationship"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>14400</IntervalSeconds>
<SyncTime/>
<ScriptName>Microsoft.JEE.WebSphere.Profile.Discover.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="WebSphere!Microsoft.JEE.WebSphere.Windows.Installation"]/MajorVersion$ $MPElement[Name='Microsoft.JEE.WebSphere.7.0.Windows.Profile']$ $MPElement[Name='Microsoft.JEE.WebSphere.7.0.WindowsComputerContainsProfile.Relationship']$ --InstallPath=$Target/Property[Type="WebSphere!Microsoft.JEE.WebSphere.Windows.Installation"]/InstallPath$</Arguments>
<ScriptBody><Script>
''' Copyright (c) Microsoft Corporation. All rights reserved.
'''
''' Date Created: Mar 21st, 2011
'
SetLocale("en-us")
'' Check if a file is too big (larger than or equal to 100 MB).
'' Return true if too big, else return false.
'' If a file does not exist, return false.
FUNCTION isFileTooBig(userSuppliedFSO, filePath, fileName)
''Set the maximum file size to 100MB
const maxFileSize = 104857600
Dim strFile, myFSO
isFileTooBig = false
strFile = filePath &amp; fileName
IF userSuppliedFSO is Nothing THEN
SET myFSO = CreateObject("Scripting.FileSystemObject")
ELSE
SET myFSO = userSuppliedFSO
END IF
IF myFSO.FileExists(strFile) = true then
'' Get a File object from a file system
set objFile = myFSO.GetFile(strFile)
'' Get the file size
fileSize = objFile.Size
IF fileSize &gt;= maxFileSize THEN
isFileTooBig = true
END IF
END IF
END FUNCTION
'
' Method to parse out a command line arguments
' The arguments can be
'
'
Function ParseOutCommandLineArg(cmdLine, arg)
Dim done
Dim pos
Dim quoted
Dim startpos
Dim gotKey
gotkey = false
quoted = false
pos = 1
startpos = 1
done = false
While not done
Select Case mid ( cmdLine , pos , 1 )
Case ""&amp;chr(34)
If gotkey and quoted Then
ParseOutCommandLineArg = mid(cmdLine,startpos,pos-startpos)
done = true
else
quoted = not quoted
End If
startpos = pos+1
Case "="
If arg = mid(cmdline,startpos,pos-startpos) Then
startpos = pos+1
gotkey = true
End If
Case " "
If gotkey Then
If not quoted Then
ParseOutCommandLineArg = mid(cmdLine,startpos,pos-startpos)
done = true
End If
Else
If arg = mid(cmdline,startpos,pos-startpos) Then
startpos = pos+1
gotkey = true
End If
End If
If not quoted Then
startpos = pos+1
End If
End Select
pos = pos + 1
if not done then
if pos &gt;len(cmdLine) Then
If gotkey Then
If not quoted Then
ParseOutCommandLineArg = mid(cmdLine,startpos,pos-startpos)
done = true
End If
End If
done = true
End If
End If
Wend
End Function
'
' Method to log an error to the windows event log
'
Function LogError(oAPI, scriptName, description)
Call oAPI.LogScriptEvent(scriptName, 100, 1, description)
End Function
'
' Method to log an error when failing to find a file
'
Function LogErrorFileNotFound(oAPI, scriptName, fileName)
LogError oAPI, scriptName, "Could not find expected configuration file: " &amp; fileName
End Function
'
' Method to log an error when failing to find a folder
'
Function LogErrorFolderNotFound(oAPI, scriptName, folderName)
LogError oAPI, scriptName, "Could not find expected folder: " &amp; folderName
End Function
'
' Method to log an error when failing to parse a file
'
Function LogErrorParsingFile(oAPI, scriptName, fileName)
LogError oAPI, scriptName, "Failed to parse configuration file: " &amp; fileName
End Function
'
' Method to log an error when failing to commuincate over HTTP
'
Function LogErrorHTTP(oAPI, scriptName, url, description, errorNumber)
LogError oAPI, scriptName, "HTTP commucation failed with: " &amp; url &amp; " - " &amp; description &amp; " - " &amp; CStr(errorNumber)
End Function

' Copyright (c) Microsoft Corporation. All rights reserved.
' Date Created: June 10th, 2010
'
' This Script is to be incoporated into the WebSphere JEE MP.
' This script will discover instances of a WebSphere application
' server. Information captured is the names of the Profiles,
' Cells, and Nodes in addition to the HTTP &amp; HTTPS port. This
' is done by starting at the root location (which must be
' supplied to the script) and recursing through that local tree
' to find the serverindex.xml.
SetLocale("en-us")
'''
''' Simple Class defining the Profile Discovery data
'''
Class ProfileDiscoveryInfo
Public Profile
Public ProfilePath
Public Cell
Public Node
Public Server
Public Hostname
Public HttpPort
Public HttpsPort
End Class
'''
''' Constants for use in this script
'''
CONST WEBSPHERE_DISCOVERY_SCRIPT_NAME = "WebSphereDiscovery.vbs"
'
' From the base folder for a WebSphere installation, look in the
' Properties/profileRegistry.xml file to locate the profiles for
' this installation. Each corresponding entry has an associated
' path for the location of the profile (which may or may not be
' inside of the default application server home)
'
Function DiscoverWebSphereProfiles(oAPI, pathToBaseFolder, userSuppliedFso, userSuppliedXmlDom)
Dim fso, objProfilesFolder
Dim objXMLDoc, objProfileNodeList, objProfileNode
Dim arrayCellsResults, arrayPerProfileDiscoveryResults(), arrayOfProfilesFromRegistryXml()
Dim strProfileRegistryXmlPath
Redim arrayPerProfileDiscoveryResults(-1)
Dim strFilePath, strFileName
If userSuppliedFso Is Nothing Then
Set fso = CreateObject("Scripting.FileSystemObject")
Else
Set fso = userSuppliedFso
End If
If pathToBaseFolder = "" Then
Exit Function
End If
strFilePath = pathToBaseFolder &amp; "\properties\"
strFileName = "profileRegistry.xml"
strProfileRegistryXmlPath = strFilePath &amp; strFileName
If (Not fso.FileExists(strProfileRegistryXmlPath)) Or isFileTooBig(fso, strFilePath, strFileName) Then
LogErrorFileNotFound oAPI, WEBSPHERE_DISCOVERY_SCRIPT_NAME, strProfileRegistryXmlPath
Exit Function
End If
If userSuppliedXmlDom Is Nothing Then
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
Else
Set objXMLDoc = userSuppliedXmlDom
End If
objXMLDoc.async = False
objXMLDoc.load(strProfileRegistryXmlPath)
'
' Extract necessary information from the profileRegistry.xml file
' This gives us the number of profiles, from here we need to peer
' each profile directory and fine the requisite cell/node information
'
Set objProfileNodeList = objXMLDoc.selectNodes("/profiles/profile")
Redim arrayOfProfilesFromRegistryXml(objProfileNodeList.length - 1)
Dim intProfileReadFromXmlCounter
intProfileReadFromXmlCounter = 0
Dim counter
For counter = 0 to objProfileNodeList.length - 1
Dim objProfileReadFromXml
Set objProfileNode = objProfileNodeList.Item(counter)
Set objProfileReadFromXml = New ProfileDiscoveryInfo
objProfileReadFromXml.Profile = objProfileNode.getAttribute("name")
objProfileReadFromXml.ProfilePath = objProfileNode.getAttribute("path")
Set arrayOfProfilesFromRegistryXml(intProfileReadFromXmlCounter) = objProfileReadFromXml
intProfileReadFromXmlCounter = intProfileReadFromXmlCounter + 1
Next
'
' For each discovered profile from the 'registry' XML file,
' look into each cell (and then each node) and return back
' an array of objects representing each instance of WebSphere.
' Rather than return back a multi-dimensional array, there is
' some flattening occuring so that it is easier to read the
' results back into Operations Manager
'
Dim indexReturnValue
indexReturnValue = 0
For each objProfilesFolder In arrayOfProfilesFromRegistryXml
Dim profileName, pathToIndividualProfile
profileName = objProfilesFolder.Profile
pathToIndividualProfile = objProfilesFolder.ProfilePath
If fso.FolderExists(pathToIndividualProfile) Then
'''
''' Get a list of results for this profile, now flatten
''' into the return value
'''
arrayCellsResults = FindAndParseCellsPerProfile(oAPI, profileName, pathToIndividualProfile, fso, userSuppliedXmlDom)
If Not IsEmpty(arrayCellsResults) Then
'
' Expand the result array by the number of instances discovered
' by the Cell parsing. This is slightly unusual because the
' VB Script arrays are minus 1. So by adding two arrays together
' it is needed to add one for each array that is being added
' and then subtract one for the length of the new array
'
Dim objCellResult
For Each objCellResult In arrayCellsResults
If Not IsEmpty(objCellResult) Then
Dim intNewProfileSize
IF IsArray(arrayPerProfileDiscoveryResults) THEN
intNewProfileSize = UBOUND(arrayPerProfileDiscoveryResults) + 1
ELSE
intNewProfileSize = 0
END IF
Redim Preserve arrayPerProfileDiscoveryResults(intNewProfileSize)
Dim objProfileResult
Set objProfileResult = New ProfileDiscoveryInfo
objProfileResult.Profile = objCellResult.Profile
objProfileResult.ProfilePath = pathToIndividualProfile
objProfileResult.Cell = objCellResult.Cell
objProfileResult.Node = objCellResult.Node
objProfileResult.Server = objCellResult.Server
objProfileResult.Hostname = objCellResult.Hostname
objProfileResult.HttpPort = objCellResult.HttpPort
objProfileResult.HttpsPort = objCellResult.HttpsPort
Set arrayPerProfileDiscoveryResults(indexReturnValue) = objProfileResult
indexReturnValue = indexReturnValue + 1
End if
Next
End If ' End if checking return size of the cells array
Else
LogErrorFolderNotFound oAPI, WEBSPHERE_DISCOVERY_SCRIPT_NAME, pathToIndividualProfile
End If ' End does folder exist check
Next
Dim sizeCheck
IF IsArray(arrayPerProfileDiscoveryResults) THEN
sizeCheck = UBOUND(arrayPerProfileDiscoveryResults) + 1
ELSE
sizeCheck = 0
END IF
' Apparently, VBscript is unhappy if the returned array is an empty one
'
IF (sizeCheck &gt; 0) THEN
DiscoverWebSphereProfiles = arrayPerProfileDiscoveryResults
END IF
End Function
'''
''' For a given profile, recurse through the directory
'''
Private Function FindAndParseCellsPerProfile(oAPI, profileName, pathToIndividualProfile, userSuppliedFso, userSuppliedXmlDom)
Dim fso, objProfilesFolder, objSubFolders, objChildFolder
Dim strCellsDirPath
Dim arrayNodesResults, arrayPerCellDiscoveryResults()
Dim intSizeOfPerCellDiscoveryResults
intSizeOfPerCellDiscoveryResults = 0
'''
''' Verify that the folder exists. Then for each subfolder (which
''' represent a cell) look for the appropriate XML configuration file.
''' The returned array is then flattened into a return value of
''' per profile array.
'''
If userSuppliedFso IS NOTHING Then
Set fso = CreateObject("Scripting.FileSystemObject")
Else
Set fso = userSuppliedFso
End If
strCellsDirPath = pathToIndividualProfile &amp; "\config\cells"
If Not fso.FolderExists(strCellsDirPath) Then
LogErrorFolderNotFound oAPI, WEBSPHERE_DISCOVERY_SCRIPT_NAME, strCellsDirPath
Exit Function
End If
''' Loop through subfolders, look down into each cell for the
''' node and examine the serverindex.xml
Set objProfilesFolder = fso.GetFolder(strCellsDirPath)
For Each objChildFolder in objProfilesFolder.SubFolders
Dim cellName, pathToIndividualCell
cellName = objChildFolder.Name
pathToIndividualCell = objChildFolder.Path
''' Expecting that the cells may have found 'multiple' nodes.
''' Flatten result from to single array
arrayNodesResults = FindAndParseNodesPerCells(oAPI, pathToIndividualCell, fso, userSuppliedXmlDom)
If IsEmpty(arrayNodesResults) Then
Exit Function
End If
Dim objNodeResult, intSizeOfNodesResults
intSizeOfNodesResults = UBound(arrayNodesResults)
Dim intNewCellResultSize, index
intNewCellResultSize = intSizeOfNodesResults + intSizeOfPerCellDiscoveryResults
index = intSizeOfPerCellDiscoveryResults
Redim Preserve arrayPerCellDiscoveryResults(intNewCellResultSize)
intSizeOfPerCellDiscoveryResults = intNewCellResultSize
For Each objNodeResult In arrayNodesResults
If Not IsEmpty(objNodeResult) Then
Dim objCellResult
Set objCellResult = New ProfileDiscoveryInfo
objCellResult.Profile = profileName
objCellResult.Cell = cellName
objCellResult.Node = objNodeResult.Node
objCellResult.Server = objNodeResult.Server
objCellResult.Hostname = objNodeResult.Hostname
objCellResult.HttpPort = objNodeResult.HttpPort
objCellResult.HttpsPort = objNodeResult.HttpsPort
Set arrayPerCellDiscoveryResults(index) = objCellResult
index = index + 1
End if
Next
Next
FindAndParseCellsPerProfile = arrayPerCellDiscoveryResults
End Function
'''
''' For the Cell, find the appropriate serverindex.xml file for
''' all servers for the cell's nodes. This will return an array of discovery
''' objects that contain hostname, port, node, cell and server name.
'''
Private Function FindAndParseNodesPerCells(oAPI, pathToIndividualCell, userSuppliedFso, userSuppliedXmlDom)
Dim arrayPerCellDiscoveryResults()
Dim fso, objNodesFolder, objSubFolders, objChildFolder
Dim strNodeDirPath, intArrayLength, intCounter, intSizeOfPerNodeDiscoveryResults
intCounter = 0
intSizeOfPerNodeDiscoveryResults = 0
intTotalNumberOfFolders = 0
'''
''' Verify that the folder exists. Then for each subfolder (which
''' represent a node) look for the appropriate XML configuration file.
''' The returned array is then flattened into a return value of
''' per cell array.
'''
If userSuppliedFso Is Nothing Then
Set fso = CreateObject("Scripting.FileSystemObject")
Else
Set fso = userSuppliedFso
End If
strNodeDirPath = pathToIndividualCell &amp; "\nodes"
If Not fso.FolderExists(strNodeDirPath) Then
LogErrorFolderNotFound oAPI, WEBSPHERE_DISCOVERY_SCRIPT_NAME, strNodeDirPath
Exit Function
End If
Set objNodesFolder = fso.GetFolder(strNodeDirPath)
For each objChildFolder in objNodesFolder.SubFolders
intTotalNumberOfFolders = intTotalNumberOfFolders + 1
Next
For each objChildFolder In objNodesFolder.SubFolders
Dim nodeName, pathToIndividualNode
checkCurrentFolder = true
nodeName = objChildFolder.Name
pathToIndividualNode = objChildFolder.Path
Dim isDeploymentManagerServer
isDeploymentManagerServer = InStr(nodeName, "CellManager")
If isDeploymentManagerServer &gt; 0 Then
If CheckIfDeploymentManager(pathToIndividualNode) Then
Exit Function
End If
End If
Dim arrayServersResults
arrayServersResults = FindAndParseServersPerNode(oAPI, nodeName, pathToIndividualNode, fso, userSuppliedXmlDom)
If IsEmpty(arrayServersResults) Then
If intCounter &lt; intTotalNumberOfFolders Then
checkCurrentFolder = false
Else
Exit Function
End If
End If
If checkCurrentFolder Then
intSizeOfNodesResults = UBound(arrayServersResults)
intSizeOfPerNodeDiscoveryResults = intSizeOfPerNodeDiscoveryResults + intSizeOfNodesResults
ReDim Preserve arrayPerCellDiscoveryResults(intSizeOfPerNodeDiscoveryResults)
For Each objServerResult In arrayServersResults
If Not IsEmpty(objServerResult) Then
Set arrayPerCellDiscoveryResults(intCounter) = objServerResult
intCounter = intCounter + 1
End if
Next
End If
Next
FindAndParseNodesPerCells = arrayPerCellDiscoveryResults
End Function
'''
''' For deployment manager and admin managers we do not want to discover servers running in the node
'''
Private Function CheckIfDeploymentManager(pathToIndividualNode)
Dim fso, objNodesFolder, isdeployment
Set fso = CreateObject("Scripting.FileSystemObject")
strServerDirPath = pathToIndividualNode &amp; "\servers"
If Not fso.FolderExists(strServerDirPath) Then
CheckIfDeploymentManager = False
Exit Function
Else
CheckIfDeploymentManager = True
Exit Function
End If
End Function
'''
''' For the Node, find all servers
'''
Private Function FindAndParseServersPerNode(oAPI, nodeName, pathToIndividualNode, userSuppliedFso, userSuppliedXmlDom)
Dim arrayPerNodeDiscoveryResults()
Dim fso, objServersFolder, objSubFolders, objChildFolder
Dim strServerDirPath, intArrayLength, intCounter
intCounter = 0
intCountOfManagers = 0
'''
''' Verify that the folder exists. Then for each subfolder (which
''' represent a server) look for the appropriate XML configuration file.
''' The returned array is then flattened into a return value of
''' per node array.
'''
If userSuppliedFso Is Nothing Then
Set fso = CreateObject("Scripting.FileSystemObject")
Else
Set fso = userSuppliedFso
End If
strServerDirPath = pathToIndividualNode &amp; "\servers"
' In WebSphere Network Deployment there can be multiple servers with a common CellManager server
isCellManager = InStr(strServerDirPath, "CellManager")
If Not fso.FolderExists(strServerDirPath) And isCellManager = 0 Then
LogErrorFolderNotFound oAPI, WEBSPHERE_DISCOVERY_SCRIPT_NAME, strServerDirPath
Exit Function
End If
If Not fso.FolderExists(strServerDirPath) And isCellManager &lt;&gt; 0 Then
intCountOfManagers = intCountOfManagers + 1
End If
If fso.FolderExists(strServerDirPath) Then
Set objServersFolder = fso.GetFolder(strServerDirPath)
ReDim Preserve arrayPerNodeDiscoveryResults(objServersFolder.SubFolders.Count - 1)
For each objChildFolder In objServersFolder.SubFolders
Dim serverName, pathToIndividualServer
serverName = objChildFolder.Name
Dim objDiscoResult
Set objDiscoResult = FindAndParseXmlPerNodes(oAPI, serverName, pathToIndividualNode, fso, userSuppliedXmlDom)
If Not (objDiscoResult Is Nothing) Then
objDiscoResult.Node = nodeName
Set arrayPerNodeDiscoveryResults(intCounter) = objDiscoResult
intCounter = intCounter + 1
End If
Next
Else
Exit Function
End If
FindAndParseServersPerNode = arrayPerNodeDiscoveryResults
End Function
'''
''' Find the serverindex.xml. Parsing is delegated to a helper
''' function. For the return, one discovery object will be created
''' that contains the hostname, port, and node name.
'''
Private Function FindAndParseXmlPerNodes(oAPI, serverName, pathToIndividualNode, userSuppliedFso, userSuppliedXmlDom)
Dim fso, objServerXml
Dim strServerXmlPath
Dim strFilePath, strFileName
If userSuppliedFso Is Nothing Then
Set fso = CreateObject("Scripting.FileSystemObject")
Else
Set fso = userSuppliedFso
End If
strFilePath = pathToIndividualNode &amp; "\"
strFileName = "serverindex.xml"
strServerXmlPath = strFilePath &amp; strFileName
If (Not fso.FileExists(strServerXmlPath)) Or isFileTooBig(fso, strFilePath, strFileName) Then
LogErrorFileNotFound oAPI, WEBSPHERE_DISCOVERY_SCRIPT_NAME, strServerXmlPath
Set FindAndParseXmlPerNodes = Nothing
Exit Function
End If
Dim objReturnedDiscoInfo
Set objReturnedDiscoInfo = ParseServerIndexXml(strServerXmlPath, serverName, userSuppliedXmlDom)
If Not (objReturnedDiscoInfo Is Nothing) Then
objReturnedDiscoInfo.Server = serverName
End If
Set FindAndParseXmlPerNodes = objReturnedDiscoInfo
End Function
'''
''' Parse the serverindex.xml. This will extract the port information
''' via xpath. For the return, a discovery object will be created
''' that contains the hostname and port.
'''
Public Function ParseServerIndexXml(path, serverName, userSuppliedXmlDom)
Dim parsedResults()
Dim objWinInfo
Dim HttpPort, HttpsPort
Set objWinInfo = CreateObject("WinNTSystemInfo")
Dim objXMLDoc, objPortNode
If userSuppliedXmlDom Is Nothing Then
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
Else
Set objXMLDoc = userSuppliedXmlDom
End If
objXMLDoc.async = False
' This file has been checked existance and file size, so it is not
' necessary to check again.
objXMLDoc.load(path)
'
' Set default/illegal values for the port
HttpPort = 0
HttpsPort = 0
Set objPortNode = objXMLDoc.selectSingleNode("/serverindex:ServerIndex/serverEntries[@serverName='" &amp; serverName &amp; "']/specialEndpoints[@endPointName='WC_defaulthost']/endPoint")
If Not (objPortNode is Nothing) Then
HttpPort = objPortNode.getAttribute("port")
End If
Set objPortNode = objXMLDoc.selectSingleNode("/serverindex:ServerIndex/serverEntries[@serverName='" &amp; serverName &amp; "']/specialEndpoints[@endPointName='WC_defaulthost_secure']/endPoint")
If Not (objPortNode Is Nothing) Then
HttpsPort = objPortNode.getAttribute("port")
End If
' Bug 22993: Omit Management Profile.
' By default, the type of profile does not contain
' endpoints for WC_defaulthost or WC_defaulthost_secure
If (0 = HttpPort) Or (0 = HttpsPort) Then
Set ParseServerIndexXml = Nothing
Else
Dim objDiscoProfile
Set objDiscoProfile = new ProfileDiscoveryInfo
objDiscoProfile.Hostname = lcase(objWinInfo.ComputerName)
objDiscoProfile.HttpPort = HttpPort
objDiscoProfile.HttpsPort = HttpsPort
Set ParseServerIndexXml = objDiscoProfile
End If
End Function
'''
''' Create instances in OpsMgr for all found instances of WebSphere profiles
'''
Public Function ReturnWebSphereProfiles(oAPI, SourceId, ManagedEntityId, TargetComputer, MajorVersion, classGUID, ReleationGuid, InstallPath )
Dim oDiscoveryData, profiles, profile, oInst, oInst2, idStr
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
Dim strInstallPaths, allVersions
If 0 &lt;&gt; InStrRev(InstallPath , "|") Then
strInstallPaths = Split(InstallPath,"|")
End If
If 0 &lt;&gt; InStrRev(MajorVersion , "|") Then
allVersions = Split(MajorVersion,"|")
End If
Dim Size1, Size2
Size1 = UBound(strInstallPaths)
Size2 = UBound(allVersions)
If (Size1 = Size2) Then
For i = 0 To (Size1-1)
profiles = DiscoverWebSphereProfiles(oAPI, strInstallPaths(i), Nothing, Nothing)
IF IsArray(profiles) THEN
For Each profile In profiles
If (Not profile Is Nothing) Then
set oInst = oDiscoveryData.CreateClassInstance(classGUID)
idStr = profile.Profile &amp; "-" &amp; profile.Cell &amp; "-" &amp; profile.Node &amp; "-" &amp; profile.Server
call oInst.AddProperty("$MPElement[Name='WebSphere!Microsoft.JEE.WebSphere.Profile']/Profile$", profile.Profile)
call oInst.AddProperty("$MPElement[Name='WebSphere!Microsoft.JEE.WebSphere.Profile']/Cell$", profile.Cell)
call oInst.AddProperty("$MPElement[Name='WebSphere!Microsoft.JEE.WebSphere.Profile']/Node$", profile.Node)
call oInst.AddProperty("$MPElement[Name='WebSphere!Microsoft.JEE.WebSphere.Profile']/Server$", profile.Server)
call oInst.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/Id$", idStr)
call oInst.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/HostName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/HttpPort$", profile.HttpPort)
call oInst.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/HttpsPort$", profile.HttpsPort)
call oInst.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/Version$", allVersions(i))
call oInst.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/DiskPath$", profile.ProfilePath)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "WebSphere|" &amp; idStr)
call oDiscoveryData.AddInstance(oInst)
set oInst2 = oDiscoveryData.CreateClassInstance(classGUID)
call oInst2.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/Id$", idStr)
call oInst2.AddProperty("$MPElement[Name='JEE!Microsoft.JEE.ApplicationServer.Instance']/HostName$", TargetComputer)
set oComputer = oDiscoveryData.CreateClassInstance("$MPElement[Name='Windows!Microsoft.Windows.Computer']$")
call oComputer.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
set oContains = oDiscoveryData.CreateRelationShipInstance(ReleationGuid)
oContains.Source = oComputer
oContains.Target = oInst2
call oDiscoveryData.AddInstance(oContains)
Set oHealthServiceInstance = oDiscoveryData.CreateClassInstance( "$MPElement[Name='SC!Microsoft.SystemCenter.HealthService']$" )
call oHealthServiceInstance.AddProperty ("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer )
set oHsCnRel = oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthServiceShouldManageEntity']$")
oHsCnRel.Source = oHealthServiceInstance
oHsCnRel.Target = oInst2
call oDiscoveryData.AddInstance(oHsCnRel)
End If
Next
END If
Next
End If
Call oAPI.Return(oDiscoveryData)
End Function

Dim oArgs, oAPI, strInstallPath, strKey

Set oArgs = WScript.Arguments
if oArgs.Count &lt; 7 Then
Wscript.Quit -1
End If

'
' Due to how to MPs interact with the VBscript, it is necessary to rebuild the last parameter
' (which is installation path). Ideally install path does not have spaces; however, if it does
' the argument passed into the vbscript is not seen as one path (i.e. "C:\IBM WAS\7.0"), but instead
' as multiple arguments (i.e. "C:\IBM" "WAS\7.0")
'

strKey = "--InstallPath="
strInstallPath = "SCRIPT COULD NOT PARSE INSTALLPATH"

DIM strCommandLineArg
strCommandLineArg = ""

DIM strArg
FOR EACH strArg IN oArgs
strCommandLineArg = strCommandLineArg &amp; " " &amp; strArg
NEXT

IF 0 &lt;&gt; InStrRev(strCommandLineArg , strKey) THEN
strInstallPath = Mid(strCommandLineArg, InStrRev(strCommandLineArg, strKey) + Len(strKey))
END IF

Set oAPI = CreateObject("MOM.ScriptAPI")
ReturnWebSphereProfiles oAPI, oArgs(0), oArgs(1), oArgs(2), oArgs(3), oArgs(4), oArgs(5), strInstallPath
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>