SCOM Powershell Export-SCOMEffectiveMonitoringConfiguration cmdlet Doesn't Output Complete Data
I was working on a support case recently when it was brought to my attention that this cmdlet does not output ALL contained instance configurations even when the
" -RecurseContainedObjects"
parameter is used. Yes, really! It outputs configuration data for only one instance of each particular type, be it a logical disk or Ethernet adapter etc., you only get monitor and rule configuration output for one of a kind in the resulting .csv file. If you have three logical disks (i.e. C:, D:, E:) you will only see configuration data for one of those, whichever one gets enumerated first by the cmdlet.
To overcome this limitation I've written a script that targets a group, and "recurses" all contained objects, outputs each configuration set to a separate file, then merges all of the files together to create one complete .CSV. (Thanks to Matt Hofacker for the idea) Finally, it outputs the complete dataset to Grid View (great idea StefanRoth!) for easy viewing and filtering. The merged file is available to open in Excel if needed.
Operations Manager 2012, R2 - UR2
As always, be sure to thoroughly test this in a non-production environment first and use at your own risk.
12/2/2014: Script updated. Fixed small typo in error logging output. Removed script sample text from this blog page.
8/13/2014: Script updated.
Comments
Anonymous
September 17, 2014
In case anyone is interested in working directly with objects in powershell instead of having to process a text file, you might consider using the GetAllEffectiveMonitoringWorkflows function. documentation is on MSDN but does not include a powershell example. msdn.microsoft.com/.../hh327189.aspx I wrote a snippet below to show a framework of what you can do with it. I used this basic framework (plus some additional code) to write a Master HTML page and then a single page per server using the GROUP method above. I prefer working with the objects instead of working with CSV files so I don't use the Export-SCOMEffectiveMonitoringConfiguration CmdLet. Import-Module OperationsManager if (!($cred)) {$cred=Get-Credential -Message "SCOM Admin Credentials"} if (!($ms)) {$ms=Read-Host -Prompt "Management Server:" } $omConn=New-SCOMManagementGroupConnection $ms -PassThru $omMg=Get-SCOMManagementGroup | select -first 1 $GroupClass=Get-SCOMClass -name "Microsoft.SystemCenter.AllComputersGroup" # Display Name --> All Windows Computers $Group=Get-SCOMMonitoringObject -Class $groupclass $Members=$group.GetRelatedMonitoringObjects() foreach ($member in ($Members |sort-object displayname) ) { $Workflows=$omMG.EffectiveMonitoring.GetAllEffectiveMonitoringWorkflows($member.id,$true) foreach ($WorkFlow in ($WorkFlows|sort-object DisplayName)) {"$($member.DisplayName)" " Workflow:$($workflow.WorkflowName)" #" :$($workFlow.<property>)" #" :$($workFlow.<property>)" #" :$($workFlow.<property>)" if ($workflow.overridden) { " Overrides" foreach ($Override in $workflow.overrideableparameters) { " Name=$($override.parametername); Default=$($override.defaultvalue); Effective=$($override.effectiveValue)" } } else {" --NO Overrides--" } } }Anonymous
September 18, 2014
Cool !!! Thanks, Craig.