SCOM 2012 R2 – New PowerShell Cmdlets

I like to play around with PowerShell and I am always looking for new cmdlets Microsoft creates for us. Isn’t it like getting Christmas gifts all the time :)? Today I wanted to find out if there are any new gifts in SCOM 2012 R2 (Preview). For a reference I will compare a SCOM 2012 SP1 installation against a SCOM 2012 R2 installation. Let’s start the fun…

All the Operations Manager cmdlet goodies are located in the OperationsManager PowerShell modules. If we compare the cmdlet count against each other then we will see that in SCOM 2012 SP1 166 commands and in SCOM 2012 R2 are 173 commands available. There is definitely something new…

Old (SCOM 2012 SP1):

image

New (SCOM 2012 R2):

image

Since Windows NT  I don’t like Dr. Watson anymore, therefore  lets play Sherlock Holmes and find the suspects…

I don’t have all modules on one system installed, because of that I export the cmdlets list from SCOM 2012 SP1 into a file old.txt and SCOM 2012 R2 into a text file new.txt.

Get-Command –Module OperationsManager | Select-Object Name | Out-File C:\temp\old.txt

Get-Command –Module OperationsManager | Select-Object Name | Out-File C:\temp\new.txt

I copy both file into the same c:\temp directory and then run the following commands…

$old = Get-Content C:\temp\$old.txt

$new = Get-Content C:\temp\$new.txt

Compare-Object $old $new

Et voilà, as we can see we have 7 new cmdlets….

2

For your convenience I added here part of the help files for the new commands. In my opinion the SC Advisor cmdlets are easy to understand once you read the help. Remove-SCOMUserRole is also not that hard to understand, but somewhat limited on information because of that, I added an example of Remove-SCOMUserRole.

Let’s check the syntax…

Add-SCAdvisorAgents

SYNOPSIS
    Adds Windows computers or instance groups to the group of agents reporting to the Advisor Connector.
SYNTAX
    Add-SCAdvisorAgents -InputObjects <PartialMonitoringObject[]> [-ComputerName <String[]>] [-Credential
    <PSCredential>] [-SCSession <Connection[]>] [-Confirm [<>]] [-WhatIf [<>]] [<CommonParameters>]
DESCRIPTION
    The Add-SCAdvisorAgents cmdlet adds one or more agent(s) to the group of agents reporting to the Advisor Connector.

Get-SCAdvisorAgents

SYNOPSIS
    Gets the computers and groups that are reporting to the Advisor Connector.
SYNTAX
    Get-SCAdvisorAgents [-ComputerName <String[]>] [-Credential <PSCredential>] [-SCSession <Connection[]>]
    [<CommonParameters>]
DESCRIPTION
    The Get-SCAdvisorAgents cmdlet gets the agents that are reporting to the Advisor Connector.

Get-SCAdvisorProxy

SYNOPSIS
    Gets the proxy server for connecting to the Advisor Service.
SYNTAX
    Get-SCAdvisorProxy [-ComputerName <String[]>] [-Credential <PSCredential>] [-SCSession <Connection[]>]
    [<CommonParameters>]
DESCRIPTION
    The Get-SCAdvisorProxy cmdlet gets the proxy server for connecting to the Advisor Service.

Register-SCAdvisor

SYNOPSIS
    Registers an Operations Manager management group to a System Center Advisor account.
SYNTAX
    Register-SCAdvisor -CertificatePath <String[]> [-ComputerName <String[]>] [-Credential <PSCredential>] [-SCSession
    <Connection[]>] [-Confirm [<>]] [-WhatIf [<>]] [<CommonParameters>]
DESCRIPTION
    The Register-SCAdvisor cmdlet registers an Operations Manager management group to a System Center Advisor account.

Remove-SCAdvisorAgents

SYNOPSIS
    Removes Windows computers and instance groups from the group of agents reporting to the Advisor Connector.
SYNTAX
    Remove-SCAdvisorAgents -InputObjects <PartialMonitoringObject[]> [-ComputerName <String[]>] [-Credential
    <PSCredential>] [-SCSession <Connection[]>] [-Confirm [<>]] [-WhatIf [<>]] [<CommonParameters>]
DESCRIPTION
    The Remove-SCAdvisorAgents cmdlet removes one or more agent(s) from the group of agents reporting to the Advisor Connector.

Set-SCAdvisorProxy

SYNOPSIS
    Sets the proxy server for connecting to the Advisor Service.
SYNTAX
    Set-SCAdvisorProxy -ProxyAddress <String[]> [-ComputerName <String[]>] [-Credential <PSCredential>] [-SCSession
    <Connection[]>] [-Confirm [<>]] [-WhatIf [<>]] [<CommonParameters>]DESCRIPTION
    The Set-SCAdvisorProxy cmdlet sets the proxy server for connecting to the Advisor Service.

Remove-SCOMUserRole

SYNTAX
    Remove-SCOMUserRole [-UserRole] <UserRole[]> [-WhatIf] [-Confirm]  [<CommonParameters>]

I created in SCOM a user role called “Test Operator”…

image

To remove this role, just simply use the Get-SCOMUserRole cmdlet and pipe the object to Remove-SCOMUserRole. That’s it!

image

Have fun!

3 Comments

  1. Pingback: OpsMgr 2012 R2 new PowerShell Cmdlets - Stefan Stranger's Weblog - Manage your IT Infrastructure - Site Home - TechNet Blogs

  2. Pingback: SCOM 2012 R2 – New PowerShell Cmdlets - SysManBlog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s