- Name
- Path
- DisplayName
- FullName
- IsManaged
- LastModified
- HealthState
- StateLastModified
- IsAvailable
- AvailabilityLastModified
- InMaintenanceMode
- MaintenanceModeLastModified
- MonitoringClassIds
- LeastDerivedNonAbstractMonitoringClassId
- Id
- ManagementGroup
- ManagementGroupId
- function GetDisplayName($object){
- $displayName = [System.String]::Empty
- if(($object.DisplayName -eq $null) -or ($object.DisplayName.Length -eq 0)){
- $displayName = $object.Name;
- }
- else {
- $displayName = $object.DisplayName;
- }
- $displayName;
- }
- $mg = (Get-ManagementGroupConnection).ManagementGroup
- $groups = $mg.GetRootPartialMonitoringObjectGroups() | sort DisplayName
- foreach($group in $groups) {
- Write-Host
- Write-Host $group.DisplayName
- $groupMembers = $group.GetRelatedPartialMonitoringObjects([Microsoft.EnterpriseManagement.Common.TraversalDepth]::OneLevel);
- if($groupMembers.Count -eq 0) {
- Write-Host "The group is empty"
- }
- else {
- $groupMembers | Select-Object DisplayName,Path,@{name="Type";expression={foreach-object {GetDisplayName $_.GetLeastDerivedNonAbstractMonitoringClass()}}} | sort DisplayName | ft
- $FileName = $group.DisplayName
- $FileName += ".csv"
- $OutPath = $FileName
- $groupMembers | Export-Csv -Path $OutPath -NoTypeInformation
- }
- Write-Host
- }
How to use it :
- First connect to you management group
- add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";
- set-location "OperationsManagerMonitoring::";
- new-managementGroupConnection -ConnectionString:MyRMS.MyDomain -Credential (get-credential "Domain\Account");
- set-location c:\temp
Result will be :
And you will retrieve your files in the location you have set - in my case :
This posting is provided "AS IS" with no warranties.
No comments:
Post a Comment