Command Shell Examples
Useful SQL Queries
Operations Manager 2007 Command Shell - Jonathan Almquist on Operations Manager - Site Home - TechNet Blogs

Operations Manager 2007 Command Shell

Operations Manager 2007 Command Shell

  • Comments 2
  • Likes

I hope this can serve the Operations Manager community as a good source for finding working examples of the Command Shell.

I will continue to update this table periodically.  If you subscribe to my blog, you will receive each new example as I post it.

Replace the text in red in each example with your specific parameters or criteria.

Command Task Descriptions
Add-ConnectorToTier  
Add-RemotelyManagedComputer  
Add-RemotelyManagedDevice  
Add-UserToUserRole  
Approve-AgentPendingAction Approve manual installations

Approve agent updates
Disable-NotificationSubscription  
Disable-Rule  
Enable-NotificationSubscription  
Enable-Rule  
Export-ManagementPack Export a Management Pack
Get-Agent Agent state

Resolve agent from Health Service Id

Enable Agent Proxying, by Health Service Id

Get BaseManagedEntityId for Agent

Which MS are my agents currently connected to?
Get-AgentPendingAction Approve manual installations

Approve agent updates
Get-Alert New alerts count

Count alerts that are not NEW or CLOSED

Closed alerts count

Count alerts raised on specific date

Count alerts raised in specific date range

Count all alerts, group by date

Top 10 alerts

10 most recent CRITICAL alerts (not closed)

Top 10 REPEATING alerts (not closed)

Resolve all open alerts in date range

Resolve all open alerts, by Alert Name

Resolve all open alerts generated by specific Agent

Resolve all alerts in specific Resolution State

Is alert grooming working?
Get-AlertDestination  
Get-AlertHistory Get Alert History by Alert Name
Get-Connector  
Get-DefaultSetting Return Management Group global settings
Get-Diagnostic  
Get-Discovery Return discoveries running on specific interval
Get-Event Top 10 Events
Get-FailoverManagementServer Get Primary and Failover MS List for Agent
Get-GatewayManagementServer Set failover management server for Gateway role
Get-MaintenanceWindow  
Get-ManagementGroupConnection List connected users
Get-ManagementPack Export Unit Monitors (including Thresholds)

In which Management Pack is this Group Stored?
Get-ManagementServer AD Integration LDAP Queries
Get-Monitor Returns Management Pack which contains specific Monitor

Resolve UIGeneratedMonitor to a Monitor Name

Export Unit Monitors (including Thresholds)
Get-MonitorHierarchy  
Get-MonitoringClass Get class properties

Get HOST class

Get HOST class properties (if any)

Get BASE class

Get BASE class properties (if any)

In which Management Pack is this Group Stored?
Get-MonitoringClassProperty  
Get-MonitoringObject  
Get-MonitoringObjectGroup Groups and related information
Get-MonitoringObjectPath  
Get-MonitoringObjectProperty Return discovered inventory
Get-NotificationAction  
Get-NotificationEndpoint  
Get-NotificationRecipient Return SMTP Channel Email Addresses
Get-NotificationSubscription  
Get-OperationsManagerCommand  
Get-Override All monitors overriden from specific MP

All rules overriden from specific MP

Overrides created in date range

Overrides that have been modified

Overrides modified in date range

All overrides, with settings
Get-PerformanceCounter Get last value sampled by performance collection rule
Get-PerformanceCounterValue When was the last time this agent inserted data and what was the latency?
Get-PrimaryManagementServer Get Primary and Failover MS List for Agent
Get-Recovery  
Get-RelationshipClass  
Get-RelationshipObject  
Get-RemotelyManagedComputer  
Get-RemotelyManagedDevice  
Get-ResultantCategoryOverride  
Get-ResultantRuleOverride  
Get-ResultantUnitMonitorOverride  
Get-RootManagementServer  
Get-Rule Returns the Management Pack which contains specific rule

Find collection rule for specific Event Id

Find performance collection rule for specific Object, Counter or Instance

Resolve UIGeneratedRule to a Rule Name

All rules overridden from specific MP
Get-RunAsAccount  
Get-State  
Get-Task What does this task target?
Get-TaskResult  
Get-Tier  
Get-UserRole  
Install-Agent Discover and install agent
Install-AgentByName  
Install-ManagementPack Import a Management Pack
New-CustomMonitoringObject  
New-DeviceDiscoveryConfiguration  
New-LdapQueryDiscoveryCriteria  
New-MaintenanceWindow  
New-ManagementGroupConnection Switch to another MG in Command Shell session
New-MonitoringPropertyValuePair  
New-Tier  
New-WindowsDiscoveryConfiguration  
Reject-AgentPendingAction  
Remove-ConnectorFromTier  
Remove-DisabledMonitoringObject Remove-DisabledMonitoringObject
Remove-ManagementGroupConnection  
Remove-RemotelyManagedComputer  
Remove-RemotelyManagedDevice  
Remove-Tier  
Resolve-Alert Resolve all open alerts in date range

Resolve all open alerts, by Alert Name

Resolve all open alerts generated by specific Agent
Set-AlertDestination  
Set-DefaultSetting Set Management Group Global Settings
Set-MaintenanceWindow  
Set-ManagementServer

Set failover management server for Gateway role

Set management server list for agent

Set-ProxyAgent  
Start-Discovery Discover and install agent
Start-Task  
Uninstall-Agent  
Uninstall-ManagementPack Delete a Management Pack





I do not moderate this blog anymore. If you have a question regarding this post, send me a message.

Comments
  • Thanks for the listed commands. A friendly feed back on the comment above the commands: "Replace the text in red in each example with your specific parameters or criteria."  This sentenced should be removed or add some examples with red parameters.

    All the best!

  • Most examples do have red text. You need to click on the example link to see the example, and the red text.