_Custom MSA P2000 Discovery PSscript MSA Instance

Custom.MSA.P2000.DiscoveryPSscript.MSAInstance (Discovery)

Element properties:

TargetCustom.MSA.P2000.ClassComputerRole.PerfServerSeed
EnabledTrue
Frequency86400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
PSscript1 DataSource Microsoft.Windows.TimedPowerShell.DiscoveryProvider Default

Source Code:

<Discovery ID="Custom.MSA.P2000.DiscoveryPSscript.MSAInstance" Enabled="true" Target="Custom.MSA.P2000.ClassComputerRole.PerfServerSeed" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance">
<Property TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance" PropertyID="msaName"/>
<Property TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance" PropertyID="msaSerial"/>
<Property TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance" PropertyID="folderPath"/>
<Property TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance" PropertyID="location"/>
<Property TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance" PropertyID="scsiProductID"/>
<Property TypeID="Custom.MSA.P2000.ClassCustom.MSA.Instance" PropertyID="enclosureCount"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="PSscript1" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoveryPSscriptMSAinstance.ps1</ScriptName>
<ScriptBody><Script>
param($sourceId,$managedEntityId,$computerName)

$api = New-Object -ComObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0, $sourceId, $ManagedEntityId)

$FullPaths=Get-ChildItem -Path C:\perf | Where-Object {($_.PSIsContainer)} | ForEach-Object {$_.FullName}

foreach ($path in $FullPaths) {
[xml]$GetContXMLArrInfo = Get-Content "$path\show__system.xml"

while (($i -lt 2) -and ($GetContXMLArrInfo -eq $null)){
$i++
Start-Sleep -Seconds 5
[xml]$GetContXMLArrInfo = Get-Content "$path\show__system.xml"
}

$ObjectXMLElements=$GetContXMLArrInfo.RESPONSE.OBJECT

foreach ($objElement in $ObjectXMLElements) {

$PropMSAName=($objElement.PROPERTY | where {$_.name -eq 'system-name'})

If ($PropMSAName -ne $null){

$instance = $DiscoveryData.CreateClassInstance("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']$")
$Instance.AddProperty("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']/folderPath$", $path)
$instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computerName)

$MSAName = ($PropMSAName.'#text')
$instance.AddProperty("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']/msaName$", $MSAName)

$PropMSAserial=($objElement.PROPERTY | where {$_.name -eq 'midplane-serial-number'})
$MSAserial=($PropMSAserial.'#text' )
$instance.AddProperty("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']/msaSerial$", $MSAserial)

$PropMSAlocation=($objElement.PROPERTY | where {$_.name -eq 'system-location'})
$MSAlocation=($PropMSAlocation.'#text' )
$instance.AddProperty("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']/location$", $MSAlocation)

$PropMSAproudctID=($objElement.PROPERTY | where {$_.name -eq 'scsi-product-id'})
$ProductID=($PropMSAproudctID.'#text' )
$instance.AddProperty("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']/scsiProductID$", $ProductID)

$PropMSAenclCount=($objElement.PROPERTY | where {$_.name -eq 'enclosure-count'})
$EnclCount=($PropMSAenclCount.'#text' )
$instance.AddProperty("$MPElement[Name='Custom.MSA.P2000.ClassCustom.MSA.Instance']/enclosureCount$", $EnclCount)


$discoveryData.AddInstance($instance)
}
}
}
$discoveryData
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>computerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>600</TimeoutSeconds>
</DataSource>
</Discovery>