Here is a short powershell script I've just updated to be usable in operations Manager 2012 since cmdlet have been renamed. This script will help you to retrieve alerts from a specified SCOM MP using powershell.
Note that previous version dedicated to Operations Manager 2007 R2 is here
Here is the new script :
- $mp = Get-SCOMManagementPack -name 'MPName'
- # Criteria : All alerts, raw and processed descriptions.
- # Output to : File (c:\temp\output\Alerts-all.csv)
- # Fields Selected: Lots.
- # Output Format : CSV
- # Notes : Need more work on this.
- $alerts_csv = "C:\MPName.csv";
- write-host "Exporting all alerts to csv: ",$alerts_csv;
- Get-SCOMAlert | select-object @{Name = '%'; expression ={$_.MonitoringObjectDisplayName}},Severity, Name, ResolutionState, RepeatCount,@{Name = 'Instances'; expression ={$_.RepeatCount+1}},@{Name = 'Created'; expression =
- {$_.TimeRaised.ToLocalTime()}},@{Name = 'Description (Processed)';Expression = {$_.Description -replace "`n"," " -replace " "," "}},MonitoringObjectFullName, IsMonitorAlert,Id,MonitoringRuleId,MonitoringClassId,Description | sort Name | export-csv $alerts_csv -noTypeInformation;
Replace MPName in red by the your MP Name. Il will export all alerts in a CSV file.
This posting is provided "AS IS" with no warranties.
No comments:
Post a Comment