3600
DiscoverProtectionGroups.ps1
param ([string] $DPMServerName, $Target, $Element)
$momapi = new-object -comObject "MOM.ScriptAPI"
$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "Script Started: $DPMServerName, $Target, $Element, $Domain")
$discData = $momapi.CreateDiscoveryData(0, $Element, $Target)
$dpmserver = connect-dpmserver $DPMServerName
if(!$dpmserver)
{
$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "Unable to connect to $dpmservername")
exit 1
}
$PGList = @(Get-ProtectionGroup $DPMServerName)
if($PGList.Count -lt 1)
{
$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "DPM Server has no Protection Groups.")
exit 1
}
foreach ($PG in $PGList)
{
$PGCompression = $PG.Performance.Split(" ")[2]
$Instance = $discData.CreateClassInstance("$MPElement[Name='SCDPMOnline.DPM2007.Extra.ProtectionGroups']$")
$Instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $DPMServerName)
$Instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $($PG.FriendlyName))
$Instance.AddProperty("$MPElement[Name='SCDPMOnline.DPM2007.Extra.ProtectionGroups']/ProtectionGroup$", $($PG.FriendlyName))
$Instance.AddProperty("$MPElement[Name='SCDPMOnline.DPM2007.Extra.ProtectionGroups']/Compression$", $PGCompression)
$Instance.AddProperty("$MPElement[Name='MicrosoftWindowsSystemCenterDPM!Microsoft.Windows.SystemCenterDPM.ProductionServer']/ServerNameLong$", $DPMServerName)
$discData.AddInstance($Instance)
}
$discData
disconnect-dpmserver $DPMServerName
$momapi.LogScriptEvent("SCDPMOnline.DPM2007.Extra", 5150, 4, "Script Complete")
Microsoft.DataProtectionManager.PowerShell
DPMServerName
$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$
Target
$Target/Id$
Element
$MPElement$
300