Firstly, lets open the Operations Manager Shell. Once opened you can start using the commands as indicated below. You can always change the path indicated in red.
- The below command retrieve a list of subscriptions.
Get-NotificationSubscription |%{$c=$_.ToRecipients; $b=@($c|%{$_.Name});
$d=@($c|%{$_.Devices}|%{$_.address});"'{0}' '{1}' '{2}'" -f
$_.DisplayName,[string]::join(':',$b),[string]::join(':',$d) }
- The below command retrieve a list of Management Packs and save it in a *.csv file.
- If you ever wanted to export a list of alerts to a document, than the below command can help you with that.
- If you ever wanted to export a list of alerts to a document, than the below command can help you with that. The only difference between this command and the one above is that this command sorts the alerts by name.
- The below command helped me out a lot. Ever came across a couple of agents showing up as greyed out on your console but they are not listed beneath each other to make the view easier? This command will pull a list of only greyed out agents.
#Initializing the Ops Mgr 2007 Powershell
provider
add-pssnapin
“Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable
errSnapin ;
set-location “OperationsManagerMonitoring::”
-ErrorVariable errSnapin ;
new-managementGroupConnection
-ConnectionString:$rootMS -ErrorVariable errSnapin ;
set-location $rootMS -ErrorVariable errSnapin ;
$WCC = get-monitoringclass -name
“Microsoft.SystemCenter.Agent”
$MO = Get-MonitoringObject
-monitoringclass:$WCC | where {$_.IsAvailable -eq $false}
!!PLEASE NOTE THE BELOW COMMANDS WILL ONLY WORK ON SCOM 2012!!
- The below command is to get a count of Warning alerts generated by a rule.
- The below command is to get a count of Warning alerts generated by a monitor.
- The below command is to get a count of Critical alerts generated by a rule.
- The below command is to get a count of Critical alerts generated by a Monitor.
Please let me know if there is any issues with the commands and feel free to send me some of your PowerShell commands and I will update my page with it after testing.
Hope that this post was helpful.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.