OM12 Command Shell vs OpsMgr2007 Command Shell

Now that System Center Operations Manager 2012 (OM12) Beta available is, it’s time to compare the OM12 Command Shell with the OpsMgr 2007 Command Shell.

 

Snapin vs Module

OpsMgr 2007 has a PoweShell Snapin and OM12 uses a PowerShell Module. Modules are a new feature of PowerShell v2 are now widely used in PowerShell. Modules allow you a cleaner way to work with groups of scripts, because they can contain private variables that only those scripts share. You can also refer to a function within a module, which allows you to group commands more logically and to use more common function names without fear of overwriting the names of other functions. More info can be found here.

How do you know if Snapins or Modules are being used?

Just open the Operations Manager Shell in OpsMgr 2007 and type: get-pssnapin -registered.

image

There we have it, it’s a Snapin

Now on your OM12 server open the Operations Manager Shell and type: get-module -listavailable

image

But wait, there is more. Let’s check if there is also a Snapin.

image

Seems we also have installed the “old” OpsMgr 2007 Snapin.

 

Commands (Verbs & Nouns)

Let’s start with checking the PowerShell Best-practices for the OM12 Cmdlets and Functions:

When importing a module or Snapin with the verbose parameter, PowerShell checks if unapproved verbs are being used.

More information about Cmdlet Verb Names can be found here: https://msdn.microsoft.com/en-us/library/ms714428.aspx

OpsMgr 2007 had one unapproved verb, the Reject-AgentPending Cmdlet

You can check this yourself by using the import-module "C:\Program Files\System Center Operations Manager 2007\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.dll" -verbose

image

Let’s check OM12 for unapproved verbs:

image

No unapproved verbs for the Commands used in OM12 Smile Seems we have followed our own naming principles this time Winking smile

 

Number of OM12 Commands.

We can retrieve the number of OM12 commands by using the next commands: (Get-Command -Module OperationsManager).count

image

So in OM12 we have 87 Commands to help us manage OM12. We can check the number of Commands for OpsMgr 2007 using PowerShell Remoting from the OM12 Management Server:

Enter-PSSession –ComputerName OpsMgrRMS.stranger.local -Credential (Get-Credential) add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client" Set-Location "OperationsManagerMonitoring::" New-ManagementGroupConnection -connectionString:opsmgrrms.stranger.local Set-Location opsmgrrms.stranger.local (get-operationsmanagercommand).count

image

So OM12 and OpsMgr 2007 have both 87 Commands.

 

List of OM12 Commands

OM12   OpsMgr  

Name

CommandType Name CommandType

Add-SCOMAgentlessManagedComputer Approve-SCOMPendingManagement Deny-SCOMPendingManagement Disable-SCOMAgentProxy Disable-SCOMDiscovery Disable-SCOMMonitor Disable-SCOMNotificationSubscription Disable-SCOMRule Enable-SCOMAgentProxy Enable-SCOMDiscovery Enable-SCOMMonitor Enable-SCOMNotificationSubscription Enable-SCOMRule Export-SCManagementPack Export-SCOMEffectiveMonitoringConfiguration Export-SCOMManagementPack Get-SCClass Get-SCDiscovery Get-SCManagementGroupConnection Get-SCManagementPack Get-SCOMAccessLicense Get-SCOMAgent Get-SCOMAgentlessManagedComputer Get-SCOMAgentManagementServerSetting Get-SCOMAlert Get-SCOMAlertHistory Get-SCOMClass Get-SCOMClassInstance Get-SCOMCommand Get-SCOMConnector Get-SCOMDiagnostic Get-SCOMDiscovery Get-SCOMEvent Get-SCOMGatewayManagementServer Get-SCOMGroup Get-SCOMMaintenanceMode Get-SCOMManagementGroupConnection Get-SCOMManagementPack Get-SCOMManagementServer Get-SCOMMonitor Get-SCOMNotificationAction Get-SCOMNotificationEndpoint Get-SCOMNotificationRecipient Get-SCOMNotificationSubscription Get-SCOMOverride Get-SCOMOverrideResult Get-SCOMPendingManagement Get-SCOMRecovery Get-SCOMRelationship Get-SCOMRelationshipInstance Get-SCOMResourcePool Get-SCOMRMSEmulator Get-SCOMRule Get-SCOMRunAsAccount Get-SCOMRunAsProfile Get-SCOMTask Get-SCOMTaskResult Get-SCOMUserRole Get-SCRelationship Get-SCRelationshipInstance Import-SCManagementPack Import-SCOMManagementPack Install-SCOMAgent New-SCManagementGroupConnection New-SCOMManagementGroupConnection New-SCOMResourcePool Remove-SCManagementGroupConnection Remove-SCManagementPack Remove-SCOMAgentlessManagedComputer Remove-SCOMDisabledClassInstance Remove-SCOMManagementGroupConnection Remove-SCOMManagementPack Remove-SCOMResourcePool Remove-SCOMRMSEmulator Set-SCManagementGroupConnection Set-SCOMAgentlessManagedComputer Set-SCOMAgentManagementServerSetting Set-SCOMAlert Set-SCOMMaintenanceMode Set-SCOMManagementGroupConnection Set-SCOMResourcePool Set-SCOMRMSEmulator Set-SCOMRunAsProfile Set-SCOMUserRole Start-SCOMMaintenanceMode Start-SCOMTask Uninstall-SCOMAgent

Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Alias Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Alias Cmdlet Function Cmdlet Cmdlet Alias Cmdlet Cmdlet Cmdlet Cmdlet Alias Alias Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Alias Alias Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Alias Cmdlet Cmdlet Alias Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Alias Alias Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Alias Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet

Add-ConnectorToTier Add-RemotelyManagedComputer Add-RemotelyManagedDevice Add-UserToUserRole Approve-AgentPendingAction Disable-NotificationSubscription Disable-Rule Enable-NotificationSubscription Enable-Rule Export-ManagementPack Get-Agent Get-AgentPendingAction Get-Alert Get-AlertDestination Get-AlertHistory Get-Connector Get-DefaultSetting Get-Diagnostic Get-Discovery Get-Event Get-FailoverManagementServer Get-GatewayManagementServer Get-MaintenanceWindow Get-ManagementGroupConnection Get-ManagementPack Get-ManagementServer Get-Monitor Get-MonitorHierarchy Get-MonitoringClass Get-MonitoringClassProperty Get-MonitoringObject Get-MonitoringObjectGroup Get-MonitoringObjectPath Get-MonitoringObjectProperty Get-NotificationAction Get-NotificationEndpoint Get-NotificationRecipient Get-NotificationSubscription Get-OperationsManagerCommand Get-Override Get-PerformanceCounter Get-PerformanceCounterValue Get-PrimaryManagementServer Get-Recovery Get-RelationshipClass Get-RelationshipObject Get-RemotelyManagedComputer Get-RemotelyManagedDevice Get-ResultantCategoryOverride Get-ResultantRuleOverride Get-ResultantUnitMonitorOverride Get-RootManagementServer Get-Rule Get-RunAsAccount Get-State Get-Task Get-TaskResult Get-Tier Get-UserRole Install-Agent Install-AgentByName Install-ManagementPack New-CustomMonitoringObject New-DeviceDiscoveryConfiguration New-LdapQueryDiscoveryCriteria New-MaintenanceWindow New-ManagementGroupConnection New-MonitoringPropertyValuePair New-Tier New-WindowsDiscoveryConfiguration Reject-AgentPendingAction Remove-ConnectorFromTier Remove-DisabledMonitoringObject Remove-ManagementGroupConnection Remove-RemotelyManagedComputer Remove-RemotelyManagedDevice Remove-Tier Resolve-Alert Set-AlertDestination Set-DefaultSetting Set-MaintenanceWindow Set-ManagementServer Set-ProxyAgent Start-Discovery Start-Task Uninstall-Agent Uninstall-ManagementPack

Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet Cmdlet

Some of the Commands I highlighted are some of the aliases being used in OM12.

You can get more information on Aliases by using the Get-Command -module operationsmanager –CommandType Alias

image

I guess these Aliases are created to give the OM12 Commands a consistent SCOM* Naming Convention.

And for the current OM12 Commands we also see we have created a Function Get-SCOMCommand. So how is that Get-SCOMCommand Function created?

First we are going into the Function drive.

CD Function:

Next we are using the Get-Content Cmdlet to look into the Get-SCOMCommand function.

Get-Content Get-SCOMCommand

image

Ok, we just created a function which uses the Get-Command –Module OperationsManager to list all SCOM Commands Smile

 

This is it for now, but I’ll try to post more about the new OM12 Commands.

Tweet