HPEnterpriseStorage3PARStoreServFileControllerMP_WMI_DiscoveryDataSource (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsHPEnterpriseStorage3PARStoreServFileControllerMP_HPDiscoveryAccount
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.CommandExecuterDiscoveryDataSource Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$

Source Code:

<DataSourceModuleType ID="HPEnterpriseStorage3PARStoreServFileControllerMP_WMI_DiscoveryDataSource" Accessibility="Internal" RunAs="HPEnterpriseStorage3PARStoreServFileControllerMP_HPDiscoveryAccount" Batching="false">
<Configuration>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="SystemLibrary!System.CommandExecuterDiscoveryDataSource">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<ApplicationName>%windir%\System32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>$file/HPEnterpriseStorage3PARStoreServFileControllerMPDiscoveryScript.vbs$ 0 $MPElement$ $Target/Id$ $Target/Property[Type="WindowsLibrary!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="WindowsLibrary!Microsoft.Windows.Computer"]/NetworkName$</CommandLine>
<TimeoutSeconds>60</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>HPEnterpriseStorage3PARStoreServFileControllerMPDiscoveryScript.vbs</Name>
<Contents><Script>
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Purpose: Script create an instance of 3PARStoreServ File Controller Discovery Class
'Input: strTargetComputer , strSourceType, strSourceId, strManagedEntityId and strPrincipalName
'Return Vaues : Discovery Data
'Date Created: 28 March 2014
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim objDiscoveryEmptyData
Sub Main()
Dim oArgs, objAPI
Set oArgs = WScript.Arguments
Dim strSourceType, strSourceId, strManagedEntityId, strPrincipalName, blnfound, strTargetComputer
strSourceType = oArgs(0)
strSourceId = oArgs(1)
strManagedEntityId = oArgs(2)
strPrincipalName = oArgs(3)
strTargetComputer = oArgs(4)

Dim objDiscoveryData, objInstance, strModel
Set objAPI = CreateObject("MOM.ScriptAPI")
Set objDiscoveryData = objAPI.CreateDiscoveryData(strSourceType, strSourceId, strManagedEntityId)
Set objShell = CreateObject("Wscript.Shell")

Call objAPI.LogScriptEvent("HPStorageScript", 100, 0, "Inside discovery")

Set objWMISet1 = WMIGetInstance("winmgmts:\\" + strTargetComputer + "\root\wmi", "MS_SystemInformation", False, blnfound)

If blnfound Then
For Each objOW1 in objWMISet1
'Call objAPI.LogScriptEvent("HPStorageScript", 100, 0, objOW1.Caption)
strModel = strStringSearch(objOW1.SystemProductName)
Call objAPI.LogScriptEvent("HPStorageScript", 100, 0, strModel)
if strModel = "3PARStoreServ" then
Call objAPI.LogScriptEvent("HPStorageScript", 100, 0, "Inside If")
Set objInstance = objDiscoveryData.CreateClassInstance("$MPElement[Name='HPEnterpriseStorage3PARStoreServFileControllerMP.WMI.3PARStoreServ']$")
Call objInstance.AddProperty("$MPElement[Name='WindowsLibrary!Microsoft.Windows.Computer']/PrincipalName$", strPrincipalName)
Call objInstance.AddProperty("$MPElement[Name='SystemLibrary!System.Entity']/DisplayName$", strPrincipalName)
Call objInstance.AddProperty("$MPElement[Name='HPEnterpriseStorage3PARStoreServFileControllerMP.WMI.3PARStoreServ']/Name$", strPrincipalName)
Call objInstance.AddProperty("$MPElement[Name='HPEnterpriseStorage3PARStoreServFileControllerMP.WMI.3PARStoreServ']/Model$", "HPE 3PAR StoreServ File Controller")
Call objDiscoveryData.AddInstance(objInstance)
Set objInstance = Nothing
End If

Next
End if
Call objAPI.Return(objDiscoveryData)
End Sub

Function WMIGetInstance(sNamespace, sInstance, bErrorFlag, ByRef blnfound)
Dim objWMI, objInstance, nInstanceCount
Set objInstance = Nothing
blnfound = false

On Error Resume Next
Set objWMI = GetObject(sNamespace)
If IsEmpty(objWMI) Then
If bErrorFlag = True Then
ThrowScriptError "Unable to open WMI Namespace '" &amp; sNamespace &amp; "'. Check to see if the WMI service is enabled and running, and ensure this WMI namespace exists.", Err
Else
Set WMIGetInstance = Nothing
Exit Function
End If
End If

Set objInstance = objWMI.InstancesOf(sInstance)
If IsEmpty(objInstance) Or Err.Number &lt;&gt; 0 Then
If bErrorFlag = True Then
ThrowScriptError "The class name '" &amp; sInstance &amp; "' returned no instances. Please check to see if this is a valid WMI class name.", Err
Else
Set WMIGetInstance = Nothing
Exit Function
End If
End If

'Determine if we queried a valid WMI class - Count will return 0 or empty
nInstanceCount = objInstance.Count
If Err.Number &lt;&gt; 0 Then
If bErrorFlag = True Then
ThrowScriptError "The class name '" &amp; sInstance &amp; "' did not return any valid instances. Please check to see if this is a valid WMI class name.", Err
Else
Set WMIGetInstance = Nothing
Exit Function
End If
End If
On Error Goto 0

blnfound = true
Set WMIGetInstance = objInstance
Set objInstance = Nothing
Set objWMI = Nothing
End Function


Function ThrowScriptError(sMessage, oErr)
'ThrowScriptError :: Creates an event and sends it back to the mom server
Call objAPI.LogScriptEvent("HPStorage", 100, 0, sMessage)
Call objAPI.Return(objDiscoveryEmptyData)
WScript.Quit(0)
End Function

Function strStringSearch(strModel)
If instr(strModel,"3PAR StoreServ File") Then
strStringSearch = "3PARStoreServ"
End If
End Function
Main()
</Script></Contents>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>SystemLibrary!System.Discovery.Data</OutputType>
</DataSourceModuleType>