• Everything you want to know about the OM12 Cmdlets

    Did you know there is a help topic about which cmdlets are new to Operations Manger 2012, which Operations Manager 2007 cmdlets have an equivalent Operations
    Manager 2012 cmdlet ("renamed" cmdlets), and Operations Manager 2007 cmdlets that have no Operations Manager 2012 equivalent ("deprecated" cmdlets)?

    Yes there is Smile Just type Get-Help about_OpsMgr_Cmdlet_Names

    image

     

    Here it is:

    TOPIC
        about_OpsMgr_Cmdlet_Names

    SHORT DESCRIPTION
        Maps the System Center Operations Manager 2007 cmdlets to the
        Operations Manager 2012 cmdlets.


    LONG DESCRIPTION
        All cmdlets in Operations Manager 2012 have new names, and can be
        identified by the "SC" preceding the noun name. In some cases, the
        verb associated with the cmdlet has also been updated.

        This topic outlines which cmdlets are new to Operations Manger 2012,
        which Operations Manager 2007 cmdlets have an equivalent Operations
        Manager 2012 cmdlet ("renamed" cmdlets), and Operations Manager 2007
        cmdlets that have no Operations Manager 2012 equivalent ("deprecated"
        cmdlets).

        ------------------------------------------------------------------------
        OPERATIONS MANAGER 2012 MODULE NAME
        ------------------------------------------------------------------------
       
        Operations Manager 2007 snap-in   
        Microsoft.EnterpriseManagement.OperationsManager.Client

        Operations Manager 2012 module
        OM10

        ------------------------------------------------------------------------
        NEW OPERATIONS MANAGER 2012 CMDLETS
        ------------------------------------------------------------------------

        Enable-SCOMAgentProxy
        Disable-SCOMAgentProxy
        Enable-SCOMDiscovery
        Disable-SCOMDiscovery
        Set-SCOMManagementGroupConnection   
        Enable-SCOMMonitor
        Disable-SCOMMonitor
        Enable-SCOMMonitoringRule
        Disable-SCOMMonitoringRule
        Get-SCOMRunAsProfile
        Update-SCOMRunAsProfile

        ------------------------------------------------------------------------
        RENAMED CMDLETS
        ------------------------------------------------------------------------

        Operations Manager 2007 Name         Operations Manager 2012 Name
        ----------------------------                           ---------------------------- 
        Get-Agent                                                  Get-SCOMAgent
        Install-Agent                                             Install-SCOMAgent
        Uninstall-Agent                                        Uninstall-SCOMAgent
        Approve-AgentPendingAction               Approve-SCOMPendingManagement
        Get-AgentPendingAction                        Get-SCOMPendingManagement
        Reject-AgentPendingAction                   Deny-SCOMPendingManagement
        Get-Alert                                                    Get-SCOMAlert
        Resolve-Alert                                            Set-SCOMAlert
        Set-AlertDestination                               Set-SCOMAlert
        Get-AlertHistory                                      Get-SCOMAlertHistory
        Get-Connector                                         Get-SCOMConnector
        Get-Diagnostic                                         Get-SCOMDiagnostic
        Remove-DisabledMonitoringObject    Remove-SCOMDisabledClassInstance
        Get-Discovery                                           Get-SCOMDiscovery
        Get-Event                                                  Get-SCOMEvent
        Get-FailoverManagementServer          Get-SCOMAgentManagementServerSetting
        Get-GatewayManagementServer        Get-SCOMGatewayManagementServer
        Get-MaintenanceWindow                     Get-SCOMMaintenanceMode
        New-MaintenanceWindow                    Start-SCOMMaintenanceMode
        Set-MaintenanceWindow                      Update-SCOMMaintenanceMode
        Get-ManagementGroupConnection    Get-SCOMManagementGroupConnection
        New-ManagementGroupConnection    New-SCOMManagementGroupConnection
        Remove-ManagementGroupConnection    Remove-SCOMManagementGroupConnection
        Export-ManagementPack                       Export-SCOMManagementPack
        Get-ManagementPack                            Get-SCOMManagementPack
        Install-ManagementPack                        Import-SCOMManagementPack
        Uninstall-ManagementPack                   Remove-SCOMManagementPack
        Get-ManagementServer                          Get-SCOMManagementServer
        Set-ManagementServer                          Set-SCOMAgentManagementServerSetting
        Set-ManagementServer                          Set-SCOMAgentManagementServerSetting
        Get-Monitor                                              Get-SCOMMonitor
        Get-MonitorHierarchy                            Get-SCOMMonitor
        Get-MonitoringClass                               Get-SCOMClass
        Get-MonitoringObject                            Get-SCOMClassInstance
        Get-MonitoringObjectGroup                 Get-SCOMGroup
        Get-NotificationAction                          Get-SCOMNotificationAction
        Get-NotificationEndpoint                      Get-SCOMNotificationEndpoint
        Get-NotificationRecipient                     Get-SCOMNotificationRecipient
        Disable-NotificationSubscription         Disable-SCOMNotificationSubscription
        Enable-NotificationSubscription          Enable-SCOMNotificationSubscription
        Get-NotificationSubscription                Get-SCOMNotificationSubscription
        Get-Override                                             Get-SCOMOverride
        Get-PrimaryManagementServer           Get-SCOMAgentManagementServerSetting
        Set-ProxyAgent                                         Set-SCOMAgentlessManagedComputer
        Get-Recovery                                            Get-SCOMRecovery
        Get-RelationshipClass                             Get-SCOMRelationship
        Get-RelationshipObject                          Get-SCOMRelationshipInstance
        Add-RemotelyManagedComputer        Add-SCOMAgentlessManagedComputer
        Get-RemotelyManagedComputer        Get-SCOMAgentlessManagedComputer
        Remove-RemotelyManagedComputer    Remove-SCOMAgentlessManagedComputer
        Get-ResultantCategoryOverride           Get-SCOMOverride
        Get-ResultantRuleOverride                    Get-SCOMOverride
        Get-ResultantUnitMonitorOverride     Get-SCOMOverride
        Get-Rule                                                     Get-SCOMMonitoringRule
        Get-RunAsAccount                                   Get-SCOMRunAsAccount
        Get-Task                                                    Get-SCOMTask
        Start-Task                                                   Start-SCOMTask
        Get-TaskResult                                         Get-SCOMTaskResult
        Get-UserRole                                            Get-SCOMUserRole
        Add-UserToUserRole                              Update-SCOMUserRole


        ------------------------------------------------------------------------
        DEPRECATED OPERATIONS MANAGER 2007 CMDLETS
        ------------------------------------------------------------------------

        Install-AgentByName
        Get-AlertDestination
        Remove-ConnectorFromTier
        Add-ConnectorToTier
        New-CustomMonitoringObject
        Get-DefaultSetting
        Set-DefaultSetting
        New-DeviceDiscoveryConfiguration
        Get-Diagnostic
        Start-Discovery
        New-LdapQueryDiscoveryCriteria
        Get-MonitoringClassProperty
        Get-MonitoringObjectPath
        Get-MonitoringObjectProperty
        New-MonitoringPropertyValuePair
        Get-NotificationAction
        Get-NotificationEndpoint
        Get-NotificationRecipient
        Disable-NotificationSubscription
        Enable-NotificationSubscription
        Get-NotificationSubscription
        Get-OperationsManagerCommand
        Get-PerformanceCounter
        Get-PerformanceCounterValue
        Get-Recovery
        Add-RemotelyManagedDevice
        Get-RemotelyManagedDevice
        Remove-RemotelyManagedDevice
        Get-RootManagementServer
        Disable-Rule
        Enable-Rule
        Get-State
        Get-Tier
        New-Tier
        Remove-Tier
        New-WindowsDiscoveryConfiguration
       

    SEE ALSO
        about_OpsMgr_WhatsNew

  • Inside Central Podcasts–Episode 12–OpsMgr 2012 Command Shell

    Last week I had to some long car drives to one of our customers and had plenty of time to listen to some of my favorite podcasts like the PowerScripting Podcasts and Inside Central Podcasts. And in Episode 12 both of my favorite topics where discussed, PowerShell and Operations Manager.

    In this episode Pete Zerger and Dan Kregor discuss some of the changes you can expect to see to the Command Shell in OpsMgr 2012. And to my surprise they mentioned some of the PowerShell and OM12 stuff I blogged about Smile 

    And  because I love to dive into the new OM12 Cmdlets and Functions here some more things to explore.

    If you looked at my blogpost about what’s new in OM12 for PowerShell you may have noticed that in OM12 we don’t have the Resolve-Alert in OM12. We now have the Set-SCOMAlert Cmdlet.

    If we look at the help for the Set-SCOMAlert Cmdlet we see the following:

    get-help Set-SCOMAlert

    NAME
        Set-SCOMAlert
       
    SYNOPSIS
        Changes the properties of the specified alert.
       
       
    SYNTAX
        Set-SCOMAlert [-Alert] <MonitoringAlert[]> [[-CustomField7] <String>] [[-CustomField8] <String>] [[-CustomField9] <String>] [[-Owner] <String>] [[-ResolutionState] <Byte>] [[-TicketId] <String>] [[-Connector] <MonitoringConnector>] [[-CustomField1] <Strin
        g>] [[-CustomField10] <String>] [[-CustomField2] <String>] [[-CustomField3] <String>] [[-CustomField4] <String>] [[-CustomField5] <String>] [[-CustomField6] <String>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
       
       
    DESCRIPTION
        The Set-SCOMAlert cmdlet changes the properties of the specified alert.
       

    RELATED LINKS
        Online Version: http://go.microsoft.com/fwlink/?LinkID=187701
        Get-SCOMAlert
        Get-SCOMConnector

    REMARKS
        To see the examples, type: "get-help Set-SCOMAlert -examples".
        For more information, type: "get-help Set-SCOMAlert -detailed".
        For technical information, type: "get-help Set-SCOMAlert -full".

    Do you see there is no Comment property like we had in the OpsMgr 2007 Resolve-Alert Cmdlet?

    Look at the examples:

    get-help Set-SCOMAlert -examples

    NAME
        Set-SCOMAlert
       
    SYNOPSIS
        Changes the properties of the specified alert.
       
        -------------------------- EXAMPLE 1 --------------------------
       
        PS C:\>Get-SCOMAlert -ResolutionState 15 | Set-SCOMAlert -ResolutionState 255
       
       
        Description
        -----------
        This command gets all alerts with a resolution state of 15 and then uses the pipeline operator (|) to pass the alert objects to the Set-SCOMAlert cmdlet which closes the alert by setting the resolution state to 255.
        -------------------------- EXAMPLE 2 --------------------------
       
        PS C:\>Get-SCOMAlert -Name "Failed Accessing Windows Event Log" | Set-SCOMAlert -Owner "CONTOSO\Isabel" -CustomField1 "Root Cause - Permissions"
       
       
        Description
        -----------
        This command gets all alerts named "Failed Accessing Windows Event Log" and then uses the pipeline operator to pass the alert objects to the Set-SCOMAlert cmdlet which changes the owner and sets the value for CustomField1.

     

    When we look at the help for the OpsMgr 2007 R2 Resolve-Alert Cmdlet we see the following:

    >get-help resolve-alert

    NAME
        Resolve-Alert

    SYNOPSIS
        Resolves an alert.


    SYNTAX
        Resolve-Alert [-Alert] <MonitoringAlert> [[-Comment] [<String>]] [-WhatIf] [-Confirm] [<CommonParameters>]


    DESCRIPTION
        Resolves an alert.


    RELATED LINKS
        Get-Alert
        Get-AlertHistory

    REMARKS
        To see the examples, type: "get-help Resolve-Alert -examples".
        For more information, type: "get-help Resolve-Alert -detailed".
        For technical information, type: "get-help Resolve-Alert -full".

    This Cmdlet has different parameters then the Set-SCOMAlert Cmdlet, so we need to find some workarounds to solve this.

    If we still want to use the Resolve-Alert Cmdlet in OM12 we can easily create a function that does the same as the old Resolve-Alert Cmdlet. We just need to use Set-SCOMAlert with a ResolutionState of 255  to achieve the same result as
    the old resolve-alert cmdlet.

    Open your favorite PowerShell Editor and create a new Resolve-SCOMAlert Function.

    <#
    .SYNOPSIS
       Resolves an Alert
    .DESCRIPTION
       Resolves an Alert
    .PARAMETER Alert
       Specifies the alert to resolve. You can use Get-Alert to create an object to pass as the value of this parameter.
    .PARAMETER Comment
       Specifies a comment to associate with the resolved alert.
    .PARAMETER WhatIf
        Describes what would happen if you executed the command without actually executing the command.
    .PARAMETER Confirm
        Prompts you for confirmation before executing the command.
    .EXAMPLE
       C:\PS\get-SCOMalert | where-object {$_.Owner -eq "kenmeyers"} |
           resolve-SCOMalert -comment "Resolving all of Ken's alerts."
       
        This command uses Get-SCOMAlert to retrieve all alerts. It then pipes the results to Where-Object to only select the ones owned by Ken Meyers. The alerts that pass the filter are piped to Resolve-SCOMAlert to be resolved with the comment, "Resolving all of Ken's alerts."
    .EXAMPLE
        C:\PS>$alerts = get-scomalert |
        where-object {$_.ResolutionState -eq 0}

        foreach($alert in $alerts)
        {
           resolve-alert -comment "Resolving Alert" -Alert $alert
        }


        This command uses Get-Alert to retrieve unresolved alerts. Unresolved alerts have a resolution state equal to 0. The command then loops through all the unresolved alerts, calling Resolve-Alert to resolve each of them. The comment "Resolving Alert" is associated with each resolved alert.
    #>

     

    function Resolve-SCOMAlert {
    <#
    -Mandatory  - a boolean saying whether the parameter is required or not. A mandatory parameter that is not specified generates a run time exception.
    -Position – an integer specifying where parameter’s order. As you can see in the above example, the $User paramater is the third parameter, while $domain is the first and $computer the second.
    -ValueFromPipeline – a boolean indicating if the parameter can come from the pipeline.
    #>
    [CmdletBinding()]
    PARAM(
       [Parameter(Position=0, ValueFromPipeline=$true, Mandatory=$true)]
       $Alert
    ,
       [Parameter(ValueFromPipeline=$true,Mandatory=$false)]
       [AllowEmptyString()]
       [string]$Comment
    ,
       [Parameter(Mandatory=$false)]
       [boolean]$Whatif
    ,
       [Parameter(Mandatory=$false)]
       [boolean]$Confirm
     
    )

       #Set Resolutionstate Parameter for Set-SCOM Alert
       $RState = "255"
       set-variable $RState -option constant # The constant option write protect the resolutionstate property.

    # Call now the Set-SCOMAlert with the default parameter –ResolutionState 255
        if ($PSBoundParameters.TryGetValue('Comment', [ref]$Comment))
            {
                #There is no Comment Parameter in the Set-SCOMAlert Cmdlet, so we use CustomField1 for the Comment.
                $PSBoundParameters.Remove('Comment') | Out-Null
                $PSBoundParameters.Add('CustomField1', $Comment)
            }

        #Call the new OM12 Set-SCOMAlert Cmdlet with the correct parameters
        Set-SCOMAlert @psboundparameters -ResolutionState $RState
    }

    We start the new function with some help info. I just copied the help info from the old Resolve-Alert Cmdlet and only changed Resolve-Alert to the new naming convention in OM12 Resolve-SCOMAlert.

    Then I created a new Function called Resolve-SCOMAlert, which has the same parameters as the old Resolve-Alert Cmdlet, with a default value of 255 for the ResolutionState parameter.

    Because the Set-SCOMAlert is missing the Comment property we need to remove the Comment parameter from the $PSBoundParameters and replace that with a new CustomField1 property.

     

    Ok, let’s check if our new Resolve-SCOMAlert Function is working the same as our old Resolve-Alert Cmdlet in OpsMgr 2007.

    Open the Operations Console and pick an Alert we want to resolve.

    image

    We are going to resolve the “IIS Restart is required” Alert using our new Resolve-SCOMAlert function.

    Open the Operations Manager Shell and load the new Resolve-AlertSCOM Function by dotsourcing the above script.

    image

    We can now show the help of the new Resolve-SCOMAlert function with the usual get-help cmdlet.

    image

    Now we can try to use the resolve-scomalert function on our “IIS Restart is required”

    We first need to get the “IIS Restart is required” alert using the new OM12 Get-SCOMAlert Cmdlet.

    image

    When we use some formatting and extra properties we see that this is our Alert we want to resolve.

    image

    The final step is resolve this alert and add a comment.

    get-scomalert | where {$_.Name -eq "IIS Restart is required"} | resolve-SCOMAlert -Comment "Resolved with new Resolve-SCOMAlert Function"

    image

    Now let’s check if our Alert is being resolved and has the Comment in CustomField1.

    image

    It worked! Smile

    If you want to use the Whatif or the Confirm parameter you just need to add $true after those parameters. Example:
    image

    image

     

    Disclamer:  Posts in this blog are provided "AS IS" with no warranties, and confers no rights. Included script is an example script.

  • Do OM12 Management Servers have different registry keys?

    Now everybody has downloaded OM12 Release Candidate, it’s time to start exploring. Let’s start exploring the registry of the Management Servers for OM12.

    And off course we are going to use PowerShell to browse through the OM12 Registry.

    Let’s open the registry for OM12 on our first Management Server by starting PowerShell with the Run as Administrator option.

    cd "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager"

    get-childitem –recursive

    image

     

    With the following command we get the properties of the different registry keys.

    First set the  $ErrorActionPreference = silentlycontinue (this will make sure we don’t see any error messages, which I got due to an issue with long file names)

    Get-ChildItem 'hklm:\software\microsoft\microsoft operations manager' -Recurse | ForEach-Object {Get-ItemProperty $_.pspath}

     

    image

    image

     

    But would not it be nice to compare the registry keys between two Management Servers?

    I found that exporting the registry keys using Regedit and than using the Compare-Object cmdlet was the easiest way to use.

     

    You can use the following command to export the Microsoft Operations Manager keys.

    regedit /e d:\temp\exportregkeyserver1.reg "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Microsoft Operations Manager"

    image

    Just use the same command (only change the name of the file you want to export the registry key to) on your other Management Server and copy the result to your first Management Server.

    Now we can use the Compare-Object Cmdlet to compare the different Registry keys from the two Management Servers.

    Compare-Object $(Get-Content "D:\temp\exportregkeyserver1.reg") $(Get-Content "D:\temp\exportregkeyserver2.reg") | ft –wrap

    image

     

    So the most important differences between the Management Server I installed first and the second Management Server is the Reporting Key:

    get-itemproperty "hklm:\software\microsoft\microsoft operations Manager\3.0\Reporting"

    image

     

    Don’t forget to change you $ErrorActionPreference = continue

    Have fun exploring OM12 Winking smile

  • Reformatting get-scomrmsemulator cmdlet output

    Hi people I need your help. Today I was looking at the Get-SCOMRMSEmulator cmdlet in OM12 RC and noticed that when running this Cmdlet I got the following WARNING: column "Id" does not fit into the display and was removed"

     

    clip_image002

    I solved it by using the Format-Table Autosize cmdlet, but would not it be better if this Warning is not shown when running the cmdlet?

    So I created a Suggestion on Microsoft Connect to get this fixed. So please vote on Connect if you also want us to fix this for the next release.

    I also suggested to remove the Id property from the default output shown. This is not adding any valuable information about the RMS Emulator anyway. (to my knowledge)

    Maybe you can suggest better properties to show.

    clip_image002[4]

     

    Thanks!

    /Stefan

  • New System Center 2012 Virtual Labs available

    Source: System Center Central

    Now that we have released System Center 2012 Release Candidate is time to start installing this release in you test environment.

    But you can already start using our Technical Virtual Labs.

    TechNet Virtual Labs enable you to quickly evaluate and test Microsoft's newest products and technologies through a series of guided, hands-on labs that you can complete in 90 minutes or less. There is no complex setup or installation required, and you can use TechNet Virtual Labs online immediately, free.

     

    Sorry for not being able to post some blogposts lately, but I’m just too busy ramping up on all our new products Winking smile