Create discovery override with PowerShell

This is a quick & dirty to create the overrides that disable the failover check for agents from my SCOM Admin mp.

$output_overrides=""
$a=gc C:\temp\file.txt
foreach ($i in $a) {
$GUID=[guid]::NewGuid().ToString("N")
$Id="OverrideForDiscoverySCOMDiscoveryWindowsComputerClassForContextMicrosoftSystemCenterHealthService$GUID"
$output_overrides+="<DiscoveryConfigurationOverride ID=""$ID"" Context=""SystemCenter!Microsoft.SystemCenter.HealthService"" ContextInstance=""$i"" Enforced=""false"" Discovery=""Admin!SCOM.Discovery.WindowsComputerClass"" Parameter=""IgnoreAgentMgmtGroups"" Module=""DS""><Value>MG_group</Value></DiscoveryConfigurationOverride>"
}
$output_mp=$output_overrides
$output_mp | Out-File "_Overrides.xml"


Comments