Export-SCOMEffectiveMonitoringConfiguration

A new cmdlet that allows you to export the effective configuration for an agent. I can’t get the example on the SCOM help file to work but have re-written it below. It will create a seperate csv file for each monitored server. Good Luck!

$MS=”<FQDN of MS>”

if ((Get-PSSnapin | Where-Object {$_.Name -eq ‘Microsoft.EnterpriseManagement.OperationsManager.Client’}) -eq $null) {
Write-Host
Write-Host “File loaded.”
Write-Host “Initializing shell for operations manager…”
Write-Host “Add Microsoft.EnterpriseManagement.OperationsManager.Client snap in.”
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client -ErrorAction SilentlyContinue -ErrorVariable Err

if ($Err) { $(throw write-Host $Err) }
}

if ((Get-ManagementGroupConnection | Where-Object {$_.ManagementServerName -eq $MS}) -eq $null) {
Write-Host “Connect to Management Server: $MS”
New-ManagementGroupConnection $MS -ErrorAction SilentlyContinue -ErrorVariable Err
if ($Err) { $(throw write-Host $Err) }
}

if ((Get-PSDrive | Where-Object {$_.Name -eq ‘Monitoring’}) -eq $null) {
Write-Host “Create Monitoring drive from Provider.”
New-PSDrive -Name: Monitoring -PSProvider: OperationsManagerMonitoring -Root: \ -ErrorAction SilentlyContinue -ErrorVariable Err

if ($Err) { $(throw write-Host $Err) }
Write-Host “Operations manager shell initialized.”
Write-Host
}

Set-Location Monitoring:\$MS
$Members = @( (Get-SCOMGroup | where {$_.displayName -eq “All Windows Computers”}).GetRelatedMonitoringObjects() )

foreach ($member in $Members)

{
$filename = $member.displayname
Export-SCOMEffectiveMonitoringConfiguration -Instance $member -Path (Join-Path -path c:\temp -ChildPath ($filename + ‘.csv’)) -RecurseContainedObjects}

Tags:

2 Responses to “Export-SCOMEffectiveMonitoringConfiguration”

  1. [...] – example Export-SCManagementPack Export-SCOMEffectiveMonitoringConfiguration – example Export-SCOMManagementPack Get-SCClass Get-SCDiscovery Get-SCManagementGroupConnection [...]

  2. [...] export-scomeffectivemonitoringconfiguration [...]

Leave a Reply