Home > SCOM 2012, System Center Family > Export-SCOMEffectiveMonitoringConfiguration

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}

Advertisements
  1. Lance Lyons
    October 22, 2013 at 6:44 pm

    Thanks for sharing. This script needs to be updated for the new cmdlets that exist. Here is a version that works for 2012 SP1.

    $MS=”Your Management Server”

    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-SCOMManagementGroupConnection | Where-Object {$_.ManagementServerName -eq $MS}) -eq $null) { Write-Host “Connect to

    Management Server: $MS” New-SCOMManagementGroupConnection $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 }

    $Members = (Get-SCOMGroup -DisplayName “All Windows Computers”).GetRelatedMonitoringObjects()

    foreach ($member in $Members)

    {
    Write-Host “member is ${member}”
    $filename = $member.displayname
    Export-SCOMEffectiveMonitoringConfiguration -Instance $member -Path (Join-Path -path c:\temp -ChildPath ($filename + ‘.csv’)) –

    RecurseContainedObjects
    }

    • Amr
      October 22, 2013 at 10:54 pm

      And Thanks for sharing Lance

  2. July 5, 2014 at 8:12 pm

    That is really interesting, You’re a very skilled blogger.
    I have joined your rss feed and look ahead to seeking extra of your wonderful post.

    Additionally, I have shared your site in my social networks

  1. March 7, 2012 at 4:26 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: