In OpsMgr 2007 we had the option to create a RSS Feed for Alerts using the Operations Web Console.

image

 

Selecting the RSS button would return the following RSS Feed info.

image

 

In System Center 2012 Operations Manager (OM2012) we don’t have that option anymore. But this is not really an issue, because with a little bit of PowerShell magic,
we can create our own OM2012 Alert RSS feed with all the Alert information we want. And that is exactly what I did when I saw an internal question about this feature
missing in OM2012.

Environment information:

    • System Center 2012 Operations Manager with RU1 installed
    • Two Management Servers (OM12MS01 and OM12MS02)
    • OM12MS01 has the web console installed.
    • Server features installed on OM12MS01:
    • Application-Server
    • AS-NET-Framework
    • Web-Server
    • Web-WebServer
    • Web-Common-Http
    • Web-Static-Content
    • Web-Default-Doc
    • Web-Dir-Browsing
    • Web-Http-Errors
    • Web-App-Dev
    • Web-Asp-Net
    • Web-Net-Ext
    • Web-ISAPI-Ext
    • Web-ISAPI-Filter
    • Web-Health
    • Web-Http-Logging
    • Web-Request-Monitor
    • Web-Security
    • Web-Windows-Auth
    • Web-Filtering
    • Web-Performance
    • Web-Stat-Compression
    • Web-Mgmt-Tools
    • Web-Mgmt-Console
    • Web-Mgmt-Compat
    • Web-Metabase
    • NET-Framework
    • NET-Framework-Core
    • RSAT
    • RSAT-Role-Tools
    • RSAT-Web-Server
    • PowerShell-ISE
    • WAS
    • WAS-Process-Model
    • WAS-NET-Environment
    • WAS-Config-APIs

    Pre-requisites:

    What is PowerShel PipeWorks?

    PowerShell Pipeworks is a Framework for making Sites and Services with Windows PowerShell. Read more about Pipeworks here.

     

    Installation steps for creating an OM2012 Alert RSS feed

    1. Download PowerShell PipeWorks Module.
    2. Copy Module to Management Server where you have installed:

    • OM2012 Management Server with Console
    • PowerShell v2.0 or higher
    • ASP.NET

    3. Unblock PipeWorks.1.0.2.6.zip file before extracting (you can also use the PowerShell v3 unblock-file Cmdlet if you have PowerShell v3 installed)
    image

    4. Extract the PipeWorks Module to your default PowerShell Module folder.
        You can check the default folders where PowerShell is looking for PowerShell modules using the following PowerShell command:
      

    $env:psmodulepath   


            image
       
        I personally have created a D:\PowerShell\Modules folder to store the PipeWorks Module and added that path to my psmodulepath variable.
        You can add a new Module Path using the following Command in PowerShell:
      

    $env:PSModulePath = $env:PSModulePath + ";D:\PowerShell\Modules"

        image

    5. Create an IIS Application Pool for PipeWorks
        image
        
        image
       
        Change the Identity of the Application Pool to use the OM2012 SDK Account (Microsoft System Center Data Access Service account).
        image    image

    6. Add PipeWorks Application
        image

        Enter Alias and Select previously created Application Pool. Enter Physical Path where to store the later to be created OM2012 RSS Alert files.
        Create Folder PipeWorks (C:\inetpub\wwwroot\PipeWorks)  if that folder does not exist.
        image

    And configure the OM12_SDK Account to connect as configuration.

    image

    And finally Test Connection.
    image

     

    7. Use PipeWorks Module to create an OM2012 Alert Web Service, which we can use as an RSS Feed.
        a. Open PowerShell ISE
        b. Load PowerShell PipeWorks Module in PowerShell ISE.
           

    import-module PipeWorks -verbose

       c. Create the following Function in the PowerShell ISE:

    function Get-MySCOMAlert {
            <#
            .Synopsis
                Shows SCOM Alerts
            .Description
                Shows SCOM Alerts for OM2012
            .Example
                Get-MySCOMAlert
            .Example
                Get-MySCOMAlert -ResolutionState New
            .Example
                Get-MySCOMAlert -ResolutionState Closed
            #>
            [CmdletBinding()]
            param
            (
            [Parameter(Mandatory=$True,
            ValueFromPipeline=$True,
            ValueFromPipelineByPropertyName=$True,
              HelpMessage='What is the ResolutionState of the Alerts you want to filter on?')]
            [string[]]$ResolutionState,
            [int]$First=50
            )
            process
            {
                if(!(Get-Module OperationsManager))
                {
                    Import-Module OperationsManager
                }
                #To convert string ResolutionStates to integers
                switch ($ResolutionState) {
                    New {[int]$ResolutionState = 0}
                    Closed {[int]$ResolutionState = 255}
                    default {return "$($ResolutionState) is unknow ResolutionState"}
                } #end Switch
                Get-scomalert -ResolutionState $ResolutionState | sort -Property TimeRaised -Descending | select Severity, Priority, Name, TimeRaised -First $First
            } #end Process
    }

    image

    We can test the Function by selecting the function and hitting F8
    Running the following command: Get-MySCOMAlert -ResolutionState "New" -First 2 returns the latest 2 OM2012 Alerts with ResolutionState New.
    image

    d. Convert Function to PipeWorks Web Service by running the following PipeWorks Command:
       

    ConvertTo-CommandService -Command (Get-Command Get-MySCOMAlert) -RunOnline -OutputDirectory C:\inetpub\wwwroot\PipeWorks\Get-MySCOMAlert -Force

    e. Check the Web Service in your Web browser by running the following command from the PowerShell ISE

    Start-Process http://localhost/PipeWorks/Get-MySCOMAlert

    You should see something like this:
    image

    You can now test the Get-MySCOMAlert Web Service by entering a ResolutionState and First (number of Alerts you want to return)
    image

    Result:
    image

    8. Retrieve RSS feed URL.
        Now we have created the Get-MySCOMAlert Web Service we can add some parameters to retrieve the RSS Feed for the OM12 Alerts.
       

    http://localhost/PipeWorks/Get-MySCOMAlert/?Get-MySCOMAlert_ResolutionState=New&Get-MySCOMAlert_First=2&-AsRSS=true

    This will return the RSS Feed for all OM2012 Alerts with a ResolutionState of new and only shows the last 2 new Alerts.

    image

     

    Have fun and let me know some other cool things you have created using PowerShell PipeWorks!!

    DISCLAIMER: THIS PROGRAM SOURCE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY REPRESENTATION OR CONDITION OF ANY KIND EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO CONDITIONS OR OTHER TERMS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. THE USER ASSUMES THE ENTIRE RISK AS TO THE ACCURACY AND THE USE OF THIS PROGRAM CODE OR RESULTING EXECUTABLE CODE