- $mp = Get-ManagementPack -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-Alert | 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;
An updated version for Operations Manager 2012 has been published >>>>>>>>>> here <<<<<<<<<<
This posting is provided "AS IS" with no warranties.
Hello I'm getting error message when trying to run the script above. Error message "Get-Managment pack is not valid cmdlet.
ReplyDeleteHello, did you connect your environement before using the script ? I mean did you use :
Delete# Load OpsMgr envir...
if ( (Get-pssnapin | where {$_.Name -eq "Microsoft.EnterpriseManagement.OperationsManager.Client" }).Name -ne "Microsoft.EnterpriseManagement.OperationsManager.Client" ) {
add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client" -ErrorVariable errSnapin; }
$RMS = "MyRMS"
$creds = Get-Credential("MyDomain\MyAccount");
$connection = New-ManagementGroupConnection -ConnectionString: $RMS -Credential: $creds #-ErrorAction:SilentlyContinue;
#New-PSDrive -Name OpsMgr -PSProvider OperationsManagerMonitoring -Root \ -Scope: Global
# Move off of a drive to avoid deadlock.
Set-Location "OperationsManagerMonitoring::" | Out-Null;
If yes, are you using Operations Manager 2007 R2 or 2012 ?
If you use Operations Manager 2007 R2 : use the Get-ManagementPack cmdlet
(http://technet.microsoft.com/en-us/library/gg132230.aspx)
If you use Operations Manager 2012, replace Get-ManagementPack cmdlet by Get-SCOMManagementPack (http://technet.microsoft.com/en-us/library/hh918497.aspx)
And Get-Alert cmdlet by Get-SCOMAlert... hope I don't miss anything.
Check new post here : http://tetris38.blogspot.fr/2013/01/opsmgr-2012powershell-get-alerts-for.html