• Update: Put OM2012 Computer Group Members in Maintenance Mode with PowerShell

    I finally found out the issue why this script was not working for everybody. It was because of the different versions of PowerShell. Now it should also work on PowerShell v2.

    Another possible fix to the empty ComputerGroupsMembernames issue.

    Last week I saw a request for a PowerShell script which would put all the members of a OM2012 Computer Group in Maintenance Mode, so this could be used with the Task Scheduler.

    I know there are quite some alternative when it comes to putting instances in Maintenance Mode, but I thought it would be cool to create the mother-of-all maintenance mode PowerShell scripts for OM2012 :-)

    This PowerShell script can be run standalone or scheduled with the Task Scheduler and has the following cool features:

    • Acts as a “real” Cmdlet, with features like:
      • Verbose info
      • Debug info
      • WhatIf switch
    • Help info with Examples
    • Write to Eventlog switch for auditing purposes.
    • No need to run it from the Operations Manager Shell. If the OperationsManager Module is not loaded it will be loaded automatically by the script.

     

    Ok enough about the features, here is the script:

    #######################################################################################################################             
    # Puts a OM2012 Computer Group in Maintenance Mode using PowerShell             
    # Author: Stefan Stranger (Microsoft)             
    # Example usage: Run Get-Help Get-SCOMMaintenanceModeForGroups.ps1 -Examples            
    # Disclamer: 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.            
    # Tested on PowerShell v3 and OM2012 environment             
    # Date: 03-07-2012             
    # Name: Get-SCOMMaintenanceModeForGroups.ps1             
    # v1.000 - 03-07-2012 - Stefan Stranger - initial sstranger's release            
    # v1.001 - 06-07-2012 - Stefan Stranger - Added Eventlog and WhatIf Switch 
    # v1.003 - 07-11-2012 - Stefan Stranger - Fixed issue on PowerShell v2, Now works on v2 and v3 # v1.004 - 16-11-2012 - Stefan Stranger - Fixed issue with empty GroupMembershipNames issue
    ######################################################################################################################## <# .SYNOPSIS Places all members of a SCOM Computer Group in into maintenance mode, and creates new active maintenance mode entries. .DESCRIPTION The Start-MaintenanceModeForGroups script places all members of a SCOM Computer Group into maintenance mode, and creates new active maintenance mode entries. When in maintenance mode, alerts, notifications, rules, monitors, automatic responses, state changes, and new alerts are suppressed for the class instance. .EXAMPLE Start-SCOMMaintenanceModeForGroup.ps1 -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -Verbose Puts all Members of the "All Windows Computer" Group in Maintenance Mode for 10 minutes, with Reason "UnplannedOther" and with Comment "Testing Maintenance Mode". Adding Verbose information. .EXAMPLE Start-SCOMMaintenanceModeForGroup.ps1 -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -Eventlog Puts all Members of the "All Windows Computer" Group in Maintenance Mode for 10 minutes, with Reason "UnplannedOther" and with Comment "Testing Maintenance Mode". Writing Eventlog information to the "Operations Manager" Eventlog (eventid 998 and eventid 999). Can be used for tracking and debugging when Task Scheduler is being used. .EXAMPLE Start-SCOMMaintenanceModeForGroup.ps1 -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -WhatIf Using the WhatIf switch shows which Members of the "All Windows Computer" Group would be put in Maintenance Mode if you had run the script. So the members are not really put into maintenance mode. For testing purposes. .PARAMETER ComputerGroup The SCOM Computer Group name for which members you want to put in Maintenance Mode. .PARAMETER EndTime Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. .PARAMETER Reason Specifies the reason for placing the resource into maintenance mode. Valid values are: UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity .Parameter Comment Allows you to type a comment about the maintenance activity. .Parameter EventLog Writes information to the "Operations Manager" Eventlog to track what is happening. .Link http://blogs.technet.com/stefan_stranger#> #requires -version 2.0 [CmdletBinding(SupportsShouldProcess=$true)] param ( [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='What is the ComputerGroup you want to put in Maintenance Mode?')] [Alias("Group")] [string[]]$ComputerGroup, [Parameter(Mandatory=$True, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$True, HelpMessage='Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. This is a required parameter')] [int]$EndTime, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity')] [string]$Reason, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='Allows you to type a comment about the maintenance activity.')] [string]$Comment, [switch]$EventLog ) set-strictmode -version latest $start=Get-Date $currentlog = $start.ToString() Write-Verbose "Starting $($myinvocation.mycommand)" Write-Verbose "Ready to put ComputerGroup $ComputerGroup in Maintenance Mode" Function Start-SCOMMaintenanceModeForGroup { <# .SYNOPSIS Sets a SCOM Group in Maintenance Mode .DESCRIPTION Sets the members of a SCOM Group in Maintenance Mode .EXAMPLE Start-SCOMMaintenanceModeForGroup -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -Verbose .PARAMETER ComputerGroup The SCOM Computer Group name for which members you want to put in Maintenance Mode. .PARAMETER EndTime Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. .PARAMETER Reason Specifies the reason for placing the resource into maintenance mode. Valid values are: UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity .Parameter Comment Allows you to type a comment about the maintenance activity. .Link http://blogs.technet.com/stefan_stranger #> [CmdletBinding(SupportsShouldProcess=$true)] param ( [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='What is the ComputerGroup you want to put in Maintenance Mode?')] [Alias("Group")] [string[]]$ComputerGroup, [Parameter(Mandatory=$True, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$True, HelpMessage='Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. This is a required parameter')] [int]$EndTime, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity')] [string]$Reason, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='Allows you to type a comment about the maintenance activity.')] [string]$Comment, [switch]$EventLog ) Begin { Write-Verbose "Starting Function Start-SCOMMaintenanceModeForGroup Function" #Check for minumum Maintenance mode period of 5 mins. if($endtime -lt 5) { Write-Error "The time span for the maintenance mode should be at least 5 minutes." -ErrorAction Stop } Write-Verbose "Following Group Members will be put in Maintenance Mode:" $ComputerGroupMembers = Get-SCOMMonitoringObject -DisplayName $ComputerGroup if($ComputerGroupMembers) { #$ComputerGroupMemberNames = ($ComputerGroupMembers.getrelatedMonitoringObjects() | select DisplayName).DisplayName
    $ComputerGroupMemberNames = ($ComputerGroupMembers.getrelatedMonitoringObjects() | select DisplayName)
    Write-Verbose "$ComputerGroupMemberNames" #Retrieve Management Servers so we can check if we don't put Management Servers in MM. $MSs = Get-SCOMManagementServer } else { Write-Error "No Members of ComputerGroup $ComputerGroup found" -ErrorAction Stop } } #End Begin Process { #Put Agents in Maintenance Mode foreach ($agent in $ComputerGroupMembers.getrelatedMonitoringObjects()) { Write-Verbose "Checking if ComputerGroup Member $agent is not a Management Server" if(($MSs | Select DisplayName) -eq $agent) { Write-Verbose "We don't want to put a Management Server in MM. Skipping" } else { Write-Verbose "Let's put Agent $Agent in Maintenance Mode" $Instance = Get-SCOMClassInstance -Name $Agent if ($PSCmdlet.ShouldProcess("Putting $Agent in Maintenande Mode for $($Endtime) minutes") ) { #Added 5 seconds to EndTime to prevent failing the Start-SCOMMaintenanceMode cmdlet. Min. 5 mins is needed. Start-SCOMMaintenanceMode -Instance $Instance -EndTime ([System.DateTime]::Now).AddSeconds(5).addMinutes($EndTime) -Reason $Reason -Comment $Comment }#End of whatif }#End of else }#End Foreach if ($PSBoundParameters['EventLog']) { write-eventlog -LogName "Operations Manager" -Source "OpsMgr SDK Service" -EventID 999 -message "The following Objects are put into in Maintenance Mode for $($EndTime) minutes: $($ComputerGroupMembers.getrelatedMonitoringObjects())" }#End if } #End Process End { Write-Verbose "Finished Function Start-SCOMMaintenanceModeForGroup Function" } } #Main try { if ($PSBoundParameters['EventLog']) { write-eventlog -LogName "Operations Manager" -Source "OpsMgr SDK Service" -EventID 998 -message "The $($myinvocation.mycommand) is used to put Objects in Maintenance Mode" } Write-Verbose "Checking if OperationsManager Module is loaded" #Check if OperationsManager Module is loaded. if(!(Get-Module OperationsManager)) { Write-Verbose "Importing OperationsManager Module" Import-Module OperationsManager -ErrorAction Stop } Write-Verbose "Checking for OM2012 environment" #Check if OM2012 is being used. if(!(Get-Module OperationsManager).Description -eq "Operations Manager OperationsManagerV10 Module") { Write-Error "This script is only for OM2012" } #Call Function if ($PSBoundParameters['EventLog']) { Start-SCOMMaintenanceModeForGroup -ComputerGroup $ComputerGroup -EndTime $EndTime -Reason $Reason -Comment $Comment -EventLog } else { Start-SCOMMaintenanceModeForGroup -ComputerGroup $ComputerGroup -EndTime $EndTime -Reason $Reason -Comment $Comment } } #End Try catch [System.IO.FileNotFoundException] { "OperationsManager Module not found" $_.Exception.Message } catch { Write-Warning "Oops something went wrong" $_.Exception.Message } $end=Get-Date Write-Debug ("Total processing time {0}" -f ($end-$start).ToString()) Write-Verbose "Ending $($myinvocation.mycommand)"

     

    You can use the Get-Help Get-SCOMMaintenanceModeForGroups.ps1 –full command in PowerShell to see the complete help for this script.

    image

    Example using the –WhatIf switch

    image

    Let’s do the real deal and put some members of my “Stefan – OM2012 Maintenance Computer Group” in Maintenance Mode for 5 minutes.

    image

    Result:

    image

    image

     

    How do use this cool PowerShell script to schedule Maintenance Mode using the Task Scheduler?

    Steps:

      1. Save script as: D:\Scripts\OM2012\Start-SCOMMaintenanceModeForGroups.ps1

      2. Open TaskScheduler (on OM2012 Management Server or where you have installed the Operations Manager Console)
        image

      3.  

        Create a new Task
        image

         

      4. Enter Name and make sure the user account under which the Scheduled Task is running is having enough permissions in SCOM. Select Run with Highest privileges.
        image

      5. Configure Trigger
        image

      6. Add action

        Program/script: powershell.exe

        Add argument (optional): D:\Scripts\OM2012\Start-SCOMMaintenanceModeForGroups.ps1 -ComputerGroup 'Stefan - OM2012 Maintenance Computer Group' -EndTime 5 -Reason "UnplannedOther" –Comment 'Testing MM' -Eventlog

        Remark: Make sure you use single quotes of ComputerGroup, Reason or Comment Parameters if space are being used in the name.

        image

      7. Enter Credentials

        clip_image001

        clip_image002

        clip_image003

    If you have scheduled to script using the EventLog Switch toy can look in the Operations Manager Eventlog for auditing info.
    image

    You can download the script from the Script Center Repository: http://gallery.technet.microsoft.com/scriptcenter/Put-OM2012-Computer-Group-43902672

    Have fun!

  • What Monitors, Rules and Discoveries are running on an OpsMgr Agent?

    How often do you get the question: “What Monitors, Rules and Discoveries are running on an OpsMgr Agent?” from your co-workers? Especially when they don’t have a clue what is being monitored for their servers.

    Most of the time you just use the EffectiveConfigurationViewer from the OpsMgr Resource Kit. It let’s you pick different objects, besides the Agents you are monitoring with OpsMgr.

    image

    image

    It’s shows quite some interesting information and let’s you export the result to an XML file. But that’s not always your co-workers want’s to see. IMO they often want to have an Excel sheet with all the Monitors and Rules running on a specific Agent. That’s what they understand and can easily read.

    What options do you have now?

    1. You can try to build some wrapper around the exported XML file, with PowerShell.
      image
    2. Use a third-party tool, like MP Studio to export the Monitors, Rules and Discoveries (workflows) running on an Agents
    3. Create a PowerShell script that does the magic Winking smile

    Let’s look at the options.

     

    Build some wrapper around the exported XML file

    This is possible, but would not give us all the information we would like to see. It can only give us the Monitor/Rule or Discovery Name and it’s state. We are interested in much more, like: Name, Description, Type, Management Pack, Overrides, etc.

    So let’s skip this option.

     

    Use a third-party tool

    In the next version of MP Studio a new feature called Silect’s Agent Explorer will be added. I’m lucky to be able to test the latest evaluation version of MP Studio and it will be able to give you almost all the information you probably need.

    If you want to see what Monitors, Rules and Discoveries are running on an Agent, you can use the Explore workflow tasks feature (Agent Explorer) to view all workflows running on all agents or a specific server.

    image

     

    It will give you an overview of all Workflows running on a specified Agent and you can export the result to Excel.

    image

    This is almost what I want to see. The only thing I’m missing in the current Agent Explorer feature is if there are overrides configured for a Monitor, Rule or Discovery. I talked with Randy Roffey from Silect about this, and he told me that would be challenge, because there can be be multiple override settings for the same workflow. Good point, but it would be nice to see if there are any overrides for a workflow, than you can always manually check the configured overrides later.

     

    PowerShell script that does the magic

    The last option we have is to create a PowerShell script that does all we want. And what do we want? We want an Excel sheet with all Monitors, Rules and Discoveries running on an Agent, with their Type, DisplayName, Description, possible Override and ManagementPack.

    image

    image

    Here you can see again 768 workflows running on the OpsMgr Agent (just like in MP Studio) but it also shows if there is an Override* being configured for the Monitor, Rule or Discovery. This still does not mean that the override is applicable for the Agent though.

    * Retrieving the Override information can be a time (CPU and Memory) consuming exercise, so I commented that part of the PowerShell script.

     

    Drawback I found using this script is the impact on the CPU and Memory when running this script and the time it takes before this script finishes. So you may take that into consideration when you run this script. First it retrieves all the Monitors, Rules and Discoveries and saves that in Memory and loops through this data in memory for finding the workflow information.

    When I tested this script in my small OpsMgr 2007 R2 environment it took 1:47 seconds to run.

    image

    But it can also take much longer Sad smile, like 27 minutes in another larger OpsMgr 2007 R2 environment.

    image

     

    If you are still interested to give the script a try, here it is:

    ###############################################################################                        
    # Get OpsMgr 2007 Running Workflows using PowerShell                        
    # This script retrieves the workflows running on an OpsMgr Agent                        
    # Authors: Jeremy Pavleck & Stefan Stranger (Microsoft)            
    # Example usage (run from OpsMgr Command Shell): Get-OpsMgrWorkflows_v1.ps1 -agentname "myagent.contoso.com" | export-csv -path c:\temp\workflows.csv            
    # Date:		30-11-2010                        
    # Name: 	Get-AgentWorkflows_v1.ps1            
    # Remarks: 	Warning: Script is CPU and Memory intensive!!            
    #		Retrieving the overrides for the Monitors, Rules and Discoveries turned out to be a time, CPU and Memory consuming exercise and I disabled it.            
    #          	You can enable it by Uncommenting that part of the script if you want to.            
    #		Script needs to run in PowerShell version 2.            
    # v1.000 - 	30/11/2010 - stefstr - initial sstranger's release                        
    ###############################################################################            
                
    param ([string]$agentname = $(read-host "Please enter OpsMgr Agent Name"))             
                
    function Get-AgentWorkflow($agentname)            
    {            
     #Original Script from Jeremy Pavleck.            
     #http://www.pavleck.net/2008/06/sp1-gem-finding-rules-running-on-remote-agents/            
     #Use the OpsMgr Task Show Running Rules and Monitors.            
     $taskobj = Get-Task | Where-Object {$_.Name -eq "Microsoft.SystemCenter.GetAllRunningWorkflows"}            
                 
     # Grab HealthService class object            
     $hsobj = Get-MonitoringClass -name "Microsoft.SystemCenter.HealthService"            
     # Find HealthService object defined for named server            
     $monobj = Get-MonitoringObject -MonitoringClass $hsobj | Where-Object {$_.DisplayName -match $agentname}            
                 
     #Start Task GetAllRunningWorkflows            
     $taskOut = Start-Task -Task $taskobj -TargetMonitoringObject $monobj            
     [xml]$taskXML = $taskOut.OutPut             
                 
     #Get Workflows            
     $workflows=$taskXML.selectnodes("/DataItem/Details/Instance/Workflow")            
                 
     #Retrieve Monitors            
     $monitors = get-monitor            
                 
     #Retrieve Rules            
     $rules = get-rule            
                 
     #Retrieve Discoveries"            
     #Used the Group-object because there are some discovery rules with the same DisplayName            
     $discoveries = get-discovery | select-object -Unique            
                 
     #Get Overrides"            
     #monitoroverrides = foreach ($monitor in Get-ManagementPack | get-override | where {$_.monitor}) {get-monitor | where {$_.Id -eq $monitor.monitor.id}}            
     #$rulesoverrides = foreach ($rule in Get-ManagementPack | get-override | where {$_.rule}) {get-rule | where {$_.Id -eq $rule.rule.id}}            
     #$discoveryoverrides = foreach ($discovery in Get-ManagementPack | get-override | where {$_.discovery}) {get-discovery | where {$_.Id -eq $discovery.discovery.id}}            
                
                
     #Check for each workflow if it's a Rule or Monitor or Discovery.            
     foreach ($workflow in $workflows)            
     {            
      #Check for Monitor            
      $monitor = $monitors | where-object {$_.Name -eq $workflow."#text"}            
                  
      if ($monitor -eq $null)            
      {            
       #Check for Rule            
       $rule = $rules | where-object {$_.Name -eq $workflow."#text"}            
       if ($rule -eq $null)            
       {             
        #Check for Discovery            
        $discovery = $discoveries | where-object {$_.Name -eq $workflow."#text"}            
        if ($discovery -eq $null)            
        {            
                    
        }            
        else            
        {            
         #Get ManagementPack            
         $mp = $discovery.getmanagementpack()            
         #Check if Discovery has an override            
         #$flag = $discoveryoverrides | Where-Object {$_.DisplayName -eq $discovery.DisplayName}            
         #if ($flag -eq $null)            
         #{            
         #	$override = "false"            
         #}            
         #else            
         #{            
         #	$override = "true"            
         #}            
         $discobject = new-object System.Management.Automation.PSObject            
         $discobject = $discobject | add-member -membertype NoteProperty -name Type -value "Discovery" -passthru            
         $discobject = $discobject | add-member -membertype NoteProperty -name DisplayName -value $discovery.DisplayName -passthru            
         $discobject = $discobject | add-member -membertype NoteProperty -name Description -value $discovery.Description -passthru            
         #$discobject = $discobject | add-member -membertype NoteProperty -name Override -value $override -passthru            
         $discobject = $discobject | add-member -membertype NoteProperty -name ManagementPack -value $mp.DisplayName -passthru            
         $discobject            
        }            
       }            
       else            
       {            
        $mp = $rule.getmanagementpack()            
        #Check if Rule has an override            
        #$flag = $ruleoverrides | Where-Object {$_.DisplayName -eq $rule.DisplayName}            
        #if ($flag -eq $null)            
        #{            
        #	$override = "false"            
        #}            
        #else            
        #{            
        #	$override = "true"            
        #}            
        $ruleobject = new-object System.Management.Automation.PSObject            
        $ruleobject = $ruleobject | add-member -membertype NoteProperty -name Type -value "Rule" -passthru            
        $ruleobject = $ruleobject | add-member -membertype NoteProperty -name DisplayName -value $rule.DisplayName -passthru            
        $ruleobject = $ruleobject | add-member -membertype NoteProperty -name Description -value $rule.Description -passthru            
        #$ruleobject = $ruleobject | add-member -membertype NoteProperty -name Override -value $override -passthru            
        $ruleobject = $ruleobject | add-member -membertype NoteProperty -name ManagementPack -value $mp.DisplayName -passthru            
        $ruleobject            
       }            
      }            
      else            
      {            
       #Get ManagementPack for Monitor            
       $mp = $monitor.getmanagementpack()            
       #Check if Monitor has an override            
       #$flag = $monitoroverrides | Where-Object {$_.DisplayName -eq $monitor.DisplayName}            
       #if ($flag -eq $null)            
       #{            
       #	$override = "false"            
       #}            
       #else            
       #{            
       #	$override = "true"            
       #}            
       $monitorobject = new-object System.Management.Automation.PSObject            
       $monitorobject = $monitorobject | add-member -membertype NoteProperty -name Type -value "Monitor" -passthru            
       $monitorobject = $monitorobject | add-member -membertype NoteProperty -name DisplayName -value $monitor.DisplayName -passthru            
       $monitorobject = $monitorobject | add-member -membertype NoteProperty -name Description -value $monitor.Description -passthru            
       #$monitorobject = $monitorobject | add-member -membertype NoteProperty -name Override -value $override -passthru            
       $monitorobject = $monitorobject | add-member -membertype NoteProperty -name ManagementPack -value $mp.DisplayName -passthru            
       $monitorobject            
      }            
     }            
                
                
    }            
                
    Get-AgentWorkflow $agentname

    Disclaimer

    This sample is not supported under any Microsoft standard support program or service. This sample is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of this sample and documentation

    remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of this sample be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use this sample or documentation, even if Microsoft has been advised of the possibility of such damages.

  • Monitoring non-domain members with OM 2012

    While the rest of the System Center community is in Vegas for MMS2012 I’m helping customers with their questions about System Center Operations Manager 2012. To be honest I’m little jealous on all the people who are in Vegas right now. Winking smile 

    So I created some more detailed documentation on how to start monitoring your non-domain members (workgroup servers in your DMZ) in  OM2012.

    It are still the same steps as in OM 2007 so if you already familiar with those steps it would be easy for you.

    I created a simple Diagram to have a high-level overview on which steps are being executed on which machines.

    Certificates_Workflow

      Environment:

      • OM12 RTM
      • Stand-Alone Windows Server 2008 CA (w2k8r2dc1.demo.stranger)
      • Two OM12 Management Servers (OM12MS01.demo.stranger and OM12MS02.demo.stranger)
      • Workgroup server in "DMZ" (OM12DMZ01.demo.dmz)

      Some important notes:

      • Server must have a FQDN, so if it is in a workgroup add a domain suffix manually.
      • The server being monitored must be able to resolve the FQDN of the OM2012 Management Server server.
      • Check if non-domain member server can connect to port 5723 from Management Server. (use telnet client)

      Guide info: http://technet.microsoft.com/en-us/library/dd362655.aspx

      Pre-reqs:

      It is assumed that you have AD CS installed, an HTTPS binding is being used, and its associated certificate has been installed. Information about creating an HTTPS binding is available in the topic How to Configure an HTTPS Binding for a Windows Server 2008 CA.

       

      High-Level steps:

    1. Download the Trusted Root (CA) certificate.
    2. Import the Trusted Root (CA) certificate
    3. Create a setup information file to use with the CertReq command-line utility.
    4. Create a request file.
    5. Submit a request to the CA using the request file.
    6. Approve the pending certificate request.
    7. Retrieve the certificate from the CA.
    8. Import the certificate into the certificate store.
    9. Import the certificate into Operations Manager using MOMCertImport.

      Step 1. Download the Trusted Root (CA) certificate

      • Log on to the computer where you installed a certificate; for example, the gateway server or management server.
      • Start Internet Explorer, and connect to the computer hosting Certificate Services; for example, https://<servername>/certsrv.
      • On the Welcome page, click Download a CA Certificate, certificate chain, or CRL.
      • On the Download a CA Certificate, Certificate Chain, or CRL page, click Encoding method, click Base 64, and then click Download CA certificate chain.
      • In the File Download dialog box, click Save and save the certificate; for example, Trustedca.p7b.
      • When the download has finished, close Internet Explorer.

      [OM12MS02.demo.stranger]

      Download a CA Certificate, certificate chain, or CRL

      clip_image002

      clip_image003

      clip_image004

      clip_image005

      Step 2. Import the Trusted Root (CA) Certificate

      • On the Windows desktop, click Start, and then click Run.
      • In the Run dialog box, type mmc, and then click OK.
      • In the Console1 window, click File, and then click Add/Remove Snap-in.
      • In the Add/Remove Snap-in dialog box, click Add.
      • In the Add Standalone Snap-in dialog box, click Certificates, and then click Add.
      • In the Certificates snap-in dialog box, select Computer account, and then click Next.
      • In the Select Computer dialog box, ensure that Local computer: (the computer this console is running on) is selected, and then click Finish.
      • In the Add Standalone Snap-in dialog box, click Close.
      • In the Add/Remove Snap-in dialog box, click OK.
      • In the Console1 window, expand Certificates (Local Computer), expand Trusted Root Certification Authorities, and then click Certificates.
      • Right-click Certificates, select All Tasks, and then click Import.
      • In the Certificate Import Wizard, click Next.
      • On the File to Import page, click Browse and select the location where you downloaded the CA certificate file, for example, TrustedCA.p7b, select the file, and then click Open.
      • On the File to Import page, select Place all certificates in the following store and ensure that Trusted Root Certification Authorities appears in the Certificate store box, and then click Next.
      • On the Completing the Certificate Import Wizard page, click Finish.

      [OM12MS02.demo.stranger]

      Open Certificates Local Computer account MMC:

      clip_image006

      Import Certificate TrustedCA.p7b

      clip_image007

      clip_image008

      clip_image009

      Step 3. Create a setup information file to use with the CertReq command-line utility.

      • On the computer hosting the Operations Manager component for which you are requesting a certificate, click Start, and then click Run.
      • In the Run dialog box, type Notepad, and then click OK.
      • Create a text file containing the following content:
        [NewRequest]
        Subject="CN=<FQDN of computer you are creating the certificate, for example, the gateway server or management server.>"
        Exportable=TRUE
        KeyLength=2048
        KeySpec=1
        KeyUsage=0xf0
        MachineKeySet=TRUE
        [EnhancedKeyUsageExtension]
        OID=1.3.6.1.5.5.7.3.1
        OID=1.3.6.1.5.5.7.3.2
      • Save the file with an .inf file name extension, for example, RequestConfig.inf.
      • Close Notepad.

      [OM12MS02.demo.stranger]

      clip_image010

      Step 4. Create a request file to use with a stand-alone CA

      • On the computer hosting the Operations Manager component for which you are requesting a certificate, click Start, and then click Run.
      • In the Run dialog box, type cmd, and then click OK.
      • In the command window, type CertReq –New –f RequestConfig.inf CertRequest.req, and then press ENTER.
      • Open the resulting file (for example, CertRequest.req) with Notepad. Copy the contents of this file onto the clipboard.

      [OM12MS02.demo.stranger]

      clip_image011

      Step 5. Submit a request to a stand-alone CA

      • On the computer hosting the Operations Manager component for which you are requesting a certificate, start Internet Explorer, and then connect to the computer hosting Certificate Services (for example, https://<servername>/certsrv).
      • On the Microsoft Active Directory Certificate Services Welcome screen, click Request a certificate.
      • On the Request a Certificate page, click advanced certificate request.
      • On the Advanced Certificate Request page, click Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file, or submit a renewal request by using a base-64-encoded PKCS #7 file.
      • On the Submit a Certificate Request or Renewal Request page, in the Saved Request text box, paste the contents of the CertRequest.req file that you copied in step 4 in the previous procedure, and then click Submit.
      • Close Internet Explorer.

      [OM12MS02.demo.stranger]

      Request a certificate

      clip_image012

      Advanced

      clip_image013

      Select Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file, or submit a renewal request by using a base-64-encoded PKCS #7 file.

      clip_image014

      clip_image015

      clip_image016

      Step 6. approve the pending certificate request

      • Log on as a certification authority administrator to the computer hosting Active Directory Certificate Services.
      • On the Windows desktop, click Start, point to Programs, point to Administrative Tools, and then click Certification Authority.
      • In Certification Authority, expand the node for your certification authority name, and then click Pending Requests.
      • In the results pane, right-click the pending request from the previous procedure, point to All Tasks, and then click Issue.
      • Click Issued Certificates, and confirm the certificate you just issued is listed.
      • Close Certification Authority.

      [W2K8R2DC1.demo.stranger]

      Click Pending Request in Certificate Authority

      clip_image017

      Click on Issue

      clip_image018

      clip_image019

      Step 7. retrieve the certificate

      • Log on to the computer where you want to install a certificate; for example, the gateway server or management server.
      • Start Internet Explorer, and connect to the computer hosting Certificate Services (for example, https://<servername>/certsrv).
      • On the Microsoft Active Directory Certificate Services Welcome page, click View the status of a pending certificate request.
      • On the View the Status of a Pending Certificate Request page, click the certificate you requested.
      • On the Certificate Issued page, select Base 64 encoded, and then click Download certificate.
      • In the File Download – Security Warning dialog box, click Save, and save the certificate; for example, as NewCertificate.cer.
      • On the Certificate Installed page, after you see the message that Your new certificate has been successfully installed, close the browser.
      • Close Internet Explorer.

      [OM12MS02.demo.stranger]

      View status of pending certificate request

      clip_image020

      Save certificate

      clip_image021

      clip_image022

      Download certificate

      clip_image023

      clip_image024

      Step 8. import the certificate into the certificate store

      • On the computer hosting the Operations Manager component for which you are configuring the certificate, click Start, and then click Run.
      • In the Run dialog box, type cmd, and then click OK.
      • In the command window, type CertReq –Accept NewCertificate.cer, and then press ENTER

      [OM12MS02.demo.stranger]

      clip_image025

      Step 9. import the certificate into Operations Manager using MOMCertImport

      • Log on to the computer where you installed the certificate with an account that is a member of the Administrators group.
      • On the Windows desktop, click Start, and then click Run.
      • In the Run dialog box, type cmd, and then click OK.
      • At the command prompt, type <drive_letter>: (where <drive_letter> is the drive where the Operations Manager 2007 installation media is located), and then press ENTER.
      • Type cd\SupportTools\i386, and then press ENTER.

      clip_image026

      Note

      On 64-bit computers, type cd\SupportTools\amd64

      • Type the following:
        MOMCertImport /SubjectName <Certificate Subject Name>
      • Press ENTER.

      [OM12MS02.demo.stranger]

      MOMCertImport /SubjectName OM12MS02.demo.stranger

      clip_image027

      Check if everything is ok

      Open the certificate that you installed on management/gateway server. Click on Details Tab and check the Serial Number.

      Now navigate to HKLM\Software\Microsoft\Microsoft Operations Manager\3.0\Machine Settings and check the value of ChannelCertificateSerialNumber. Serial number of certificate should be listed backwards here in registry.

      clip_image028

      clip_image029

      Open registry

      clip_image030

      clip_image031

      Tada!

      Pre-reqs on DMZ server:

      Make sure you have installed the OM12 Agent first before starting.

       

      clip_image039

       

      Let's check the eventlog

      clip_image041

      Repeat steps for OM12DWZ01 server in workgroup

      High-Level steps:

      • Download the Trusted Root (CA) certificate.
      • Import the Trusted Root (CA) certificate
      • Create a setup information file to use with the CertReq command-line utility.
      • Create a request file.
      • Submit a request to the CA using the request file.
      • Approve the pending certificate request.
      • Retrieve the certificate from the CA.
      • Import the certificate into the certificate store.
      • Import the certificate into Operations Manager using MOMCertImport.

      [OM12DWZ01.demo.dmz]

      Step 1. Download the Trusted Root (CA) certificate.

      clip_image042

      clip_image043

      Step 2. Import the Trusted Root (CA) certificate

      clip_image044

      Step 3. Create a setup information file to use with the CertReq command-line utility.

      clip_image045

      Step 4. Create a request file to use with a stand-alone CA

      CertReq –New –f RequestConfig.inf CertRequest.req

      clip_image046

      Step 5. Submit a request to a stand-alone CA

      clip_image047

      clip_image048

      Step 6. approve the pending certificate request

      [W2K8R2DC1.demo.stranger]

      clip_image049

      clip_image050

      Step 7. retrieve the certificate

      [OM12DMZ01.demo.dmz]

      clip_image051

      clip_image052

      Step 8. import the certificate into the certificate store

      clip_image053

      Step 9. import the certificate into Operations Manager using MOMCertImport

      MOMCertImport /SubjectName OM12DMZ01.demo.dmz

      clip_image054

      Final step is approving agent

      Check Security Settings in Operations Console.

      clip_image055

      clip_image056

      Wait for Agent to turn up in Pending Approval folder

      clip_image057

      clip_image058

      End result:

      clip_image059

     

    Have fun at MMS for those who are in Vegas, and for those who are not, well…

  • Updated version: Download MMS 2013 Videos from Channel 9

    Sitting at the McCarran International Airport waiting for my flight to Amsterdam (the Netherlands) I had some time to kill so I wrote a simpel PowerShell script which helps to easily download the MMS 2013 sessions from the Channel 9 RSS feed.

    Using the Out-GridView Cmdlet you can easily select the sessions you are interested in. Click on Ok when finished selecting the sessions you are interested in downloading.

     

    image

    After creating my initial version I got some feedback that sometimes the script did not work and with the help of Jamie Moyer (also a Senior PFE like me) we made the script more robust and added extra features like a HTML Report overview.

    You can even use the –verbose switch and other parameters to tweak the download folder. We hope you like the improvements.

    #######################################################################################################################                        
    # Description:   Download MMS 2013 Channel 9 videos
    # PowerShell version: 3                   
    # Author(s):     Stefan Stranger (Microsoft)
    #                Jamie Moyer (Microsoft          
    # Example usage: Run Get-MMS2013Channel9Videos.ps1 -path c:\temp -verbose
    #                Select using the Out-Gridview the videos you want to download and they are stored in your myvideos folder.
    #                You can multiple select videos, holding the ctrl key.
    # Disclamer:     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.
    # Date:          04-13-2012                        
    # Name:          Get-MMS2013Channel9Videos.ps1            
    # Version:       v1.001 - 04-14-2012 - Stefan Stranger - initial release
    # Version:       v1.005 - 04-29-2013 - Jamie Moyer, Stefan Stranger - added more robustness and HTML Report
    ########################################################################################################################
    #requires -version 3.0
    
    [CmdletBinding()]
    Param
    (
            # Path where to store video's locally
            [Parameter(Mandatory=$false,
                       Position=0)]
            $Path = [environment]::getfolderpath("myvideos") + "\MMS2013",
            [Parameter(Mandatory=$false,
                       Position=1)]
            $rssfeed = "http://channel9.msdn.com/Events/MMS/2013/RSS"
        )
    
    function Get-NewFileName($name)
    {
        Write-Verbose "Calling Get-NewFileName Function"
        $r=$Path+"\"+(($name -replace "[^\w\s\-]*") -replace "\s+") + ".wmv";$r
    }
    
    Write-Verbose "Remove last slash if added using the downloaddirectory Parameter"
    if ($path.EndsWith("\")){$path = $path.Substring(0,$path.Length-1)}
    write-verbose "Path is: $path"
    
    Write-Verbose "Checking if Download directory $Path exists"
    if(!(test-path $Path -PathType Container))
    {
        Write-Verbose "Creating $Path"
        New-Item -ItemType Directory $Path | Out-Null
    }
    
    Write-Verbose "Downloading RSS Feed Items from $rssfeed"
    $feeditems = Invoke-RestMethod $rssfeed
    [array]$feeditemsWithDetails = $feeditems | 
        select Title, Summary, Duration, Enclosure,creator | 
            Add-Member -MemberType ScriptProperty -Name AlreadyDownloaded -Value {(test-path("$Path\$($this.enclosure.url.split('/')[6])"))} -PassThru -Force |
            Add-Member -MemberType ScriptProperty -Name Destination -Value {("$Path\$($this.enclosure.url.split('/')[6])")} -PassThru -Force |
            Add-Member -MemberType ScriptProperty -Name Source -Value {$this.enclosure.url} -PassThru -Force |
                select AlreadyDownloaded,Title, Summary, Duration, Enclosure,Source,Destination,creator | sort Title
    
    Write-Verbose "Add all already downloaded items back to the list"
    $duplicateVideoNames = $feeditemsWithDetails |sort name| group destination | where-object {$_.Name -ne "" -and $_.Count -gt 1} | 
        ForEach-Object {$_.Group}
    
    Write-Verbose "Remove the posts with duplicate file names from the feeditemsSelected array"
    $feeditemsSelected = @($feeditemsSelected | Where-Object {$duplicateVideoNames -notcontains $_})
    
    Write-Verbose "Change video names to filenames, check to see if they are downloaded already and added them back to the array with updated details"
    $duplicateVideoNames | foreach-object {
                                            $newDestination = Get-NewFileName $_.Title
                                            $_.Destination = $newDestination
                                            $_.AlreadyDownloaded = (Test-Path $newDestination)
                                            $feeditemsWithDetails += $_
                                          }
    
    Write-Verbose "Open Out-GridView to select vidoes to download"
    [array]$feeditemsSelected = $feeditemsWithDetails| Out-GridView -PassThru | 
        select AlreadyDownloaded,Title, Summary, Duration, Enclosure,Source,Destination
    
    Write-Verbose "Downloading videos"
    $feeditemsSelected |Where-Object{!(Test-Path $_.Destination)} | 
        select Source,Destination | 
            Start-BitsTransfer -Priority Normal | Out-Null
    
    Write-Verbose "Add all already downloaded items back to the list"
    $feeditemsWithDetails | where-object {$_.AlreadyDownloaded} | 
                                foreach-object {
                                                    if(-not [bool]($feeditemsSelected | Select-String $_.Title -Quiet))
                                                    {
                                                        $feeditemsSelected += $_
                                                    }
                                               }
    
    Write-Verbose "Create HTML Report"
    $feeditemsSelected | sort Name | Out-Null
    $html = $feeditemsSelected |?{Test-Path "$($_.Destination)"} | % {@"
         <H4><a href="$($_.Destination)">$($_.Title)</a></H4> 
         <H5>Speaker(s): $($_.creator)</H5>
         <H5>$($_.Summary)</H5>
    "@}
    
    Write-Verbose "Open HTML Report"
    ConvertTo-Html -Head "<h1>My Downloaded MMS Videos - $($feeditemsSelected.Count) Downloaded</h1>" -Body $html | 
        Out-File $Path\MyMMSContent.html;start "$Path\MyMMSContent.html"

    image

    Have fun!

  • Checking Server Roles with PowerShell

    Today I’m rebuilding some of my demo servers in my demo environment and before I can install the software, some pre-requisites need to be checked. You need to check if some Windows Server Roles are installed before starting the installation.

    Off course you can just use the Server Manager to check the Roles and if necessary install the missing server roles.

    imagec

    But it’s much cooler to use PowerShell to check if you have installed the needed server roles Winking smile

    Just open Windows PowerShell, load the ServerManager Module and run the Get-WindowsFeature Cmdlet. That’s all to it.

    image

    And if you want to can also add the missing roles using the Add-WindowsFeature Cmdlet.

    Have fun learning PowerShell!

  • OpsMgr SQL Full or Differential Backup Check

    I helped a customer creating a OpsMgr Monitor for checking if the there has been a SQL Full or Differential Backup within a specified number of hours. David Scheltens created the SQL query.

    Remark: Please read information on System Center Central for more info on this article.

    This is how you could create this kind of monitor in your own environment.

    Steps:

    1. Create a Timed Script Two State Monitor.
    2. Save Monitor in other MP than Default MP.
    3. Give the Monitor a Name, like “Custom – SQL Full or Differential Backup Check”.
    4. Target the Monitor to SQL Database.
    5. Select a suitable Parent Monitor like Availability.
    6. Disable Monitor (enable by an Override later).
    7. Configure how often this Monitor should run (default is 15 mins, but you could change this depending on the time your SQL backups run)
    8. Copy script from here.
      The script uses three parameters (or arguments)
      - Param 0: The SQL connection string for the server
      - Param 1: The Database to use
      - Param 2: The threshold (in hours) to use
    9. Configure the Parameters.
       image 
    10. Configure Unhealthy Expression.
      Property[@Name='NumHours'] Greater Than 1 (threshold when your backup should have been run)
      image
    11. Configure Healthy Expression
      Property[@Name='NumHours'] Less than or equal to 1 (threshold when your backup should have been run)
      image
    12. Configure Health.
      image
    13. Configure Alerting
      I used the Reason, BackupType and Number of Hours in the Alert Description.

      image
    14. Open the MP XML file and change the data type in the xml configuration from string to integer. Since making this change, the alerts and state changes seems to occur when at the correct time.
      More info here: (thanks to Daniele Grandini)
      <ErrorExpression>

                <SimpleExpression>

                  <ValueExpression>

                    <XPathQueryType="Integer">Property[@Name='NumHours'] </XPathQuery>

                  </ValueExpression>

                  <Operator>Greater</Operator>

                  <ValueExpression>

                    <ValueType="Integer">20</Value>

                  </ValueExpression>

                </SimpleExpression>

              </ErrorExpression>

              <SuccessExpression>

                <SimpleExpression>

                  <ValueExpression>

                    <XPathQueryType="Integer">Property[@Name='NumHours'] </XPathQuery>

                  </ValueExpression>

                  <Operator>LessEqual</Operator>

                  <ValueExpression>

                    <ValueType="Integer">20</Value>

                  </ValueExpression>

                </SimpleExpression>

              </SuccessExpression>

    15. Enable the Monitor via an Override.

    Remark: You may need to Use a Run As Account with the right permission for this Monitor.

    Result:

    clip_image002

     

    Some time ago I created a Tutorial How to Associate a Run As Account to a Monitor.

     

    In Operations Manager 2007, Run As Profiles and Run As Accounts are used to select users with the privileges needed for running rules, tasks, and monitors. Management Pack authors create a rule, task, or monitor, and then associate it with a Run As Profile. The named Run As Profile is imported along with the Management Pack into Operations Manager 2007.

    The Operations Manager 2007 administrator creates a named Run As Account and specifies users and groups. The administrator then adds the Run As Account to the Run As Profile and specifies the target computers that the account should run on.

    The goal in this short tutorial is to create a Timed Script Two State Monitor and associate a run as account to this monitor and save it all in a Management Pack. The Timed Script Two State Monitor is a vbscript that uses WMI to check if BizTalk orchestrations are not started.

    I’ve got some great help from Jakub Oleksy (http://blogs.msdn.com/jakuboleksy/default.aspx) and Steve Wilson (http://www.authormps.com/dnn/)

    You can download the tutorial here.

  • System Center Operations Manager 2012 Toolbox

    After posting some years ago a blog post with all the OpsMgr 2007 tools I thought it would be time for a new OM2012 Toolbox blog post.

     

    Tool Purpose Description Author Webpage
    MPViewer 2.2 MP Viewing

    The previous version 1.7 (that works with OpsMgr 2007 and 2007 R2) was released here. Version 2.1.2 has been updated to work with OpsMgr 2012, and now includes support for MPB files (MP Bundles) as well as the ability to Unseal and Unpack MP Bundles.
    Warning: only MP Bundles that contain a single ManagementPack are supported; there are some Service Manager MPBs that contain multiple ManagementPacks in a single bundle, and this tool currently cannot deal correctly with those.

    Daniele Muscetta Link
    OverrideExplorer 3.5 MP Viewing The previous version 3.3 (that works with OpsMgr 2007 and 2007 R2) was released here. Version 3.5 has been updated to work with OpsMgr2012 and includes some minor fixes, as well as the capability to Export all overrides to an Excel spreadsheet. Daniele Muscetta Link
    Proxy Settings 1.2 View Proxy Settings The previous version 1.1 (that works with OpsMgr 2007 and 2007 R2) was released here. Version 1.2 is functionally identical to the previous version but has been just recompiled to work with OpsMgr 2012 SDK. Daniele Muscetta Link
    Management Pack Compare Util Management Pack Compare Util

    This utility allows you to compare Management Packs between your Operations Manager and/or Service Manager environments.

    Online catalog check is also available.

    Changes in this version:

    • Added Service Manager support
    • Change to grid views
    • Clear grid option
    • More compare options
    • Colors changed to help visibility 
    • Management group versions added
    Robert Ryan Link
    SCOMTypeView for MP Developer MP Authoring

    SCOMTypeView is a tool help MPAuthor visualize ManagementPackClass, ManagementPackRelationship, showing them in treeview. The most important, you can see how the specific MonitoringObject is connected with other MonitoringObject.
    This tool connect to your local ManagementGroup, showing real data in time.
     

    Haitao Chen Link

    Coretech XML Connector for SCOM 2012

    Connector Service A connector with both two way communication and with configuration possibilities. This connector will work fine with other Monitoring systems, as well as your HelpDesk system; Remedy, Servicenow etc. CoreTech Link
    System Center 2012 Operations Manager – Alert Update Connector Connector Service

    The Alert Update Connector can modify alert custom fields with additional information useful for situations like controlling alert forwarding to incident management systems and help reduce noise in the incident creation process.

    Microsoft Link
    GTMTool Dashboard Authoring

    In OpsMgr 2012, we provided users the ability to create customized dashboards using the OpsMgr 2012 console. The GTM.exe tool provided in this blog allows you to build off these dashboard investments, in particular we allow you to accomplish three specific tasks that you cannot do via the console.

    1. Turn IT Pro Console created dashboards into shippable MPs by stripping out management group specific parameters (removes MG GUIDs from dashboard MPs)

    2. Provides the ability to have a custom dashboard show up under any Management Pack folder in the Monitoring view.

    3. Have a custom dashboard be launched from the task pane when you pick a specific computer or object.

    Satya Vel Link
    Operations Manager 2012 Sizing Helper Tool Design The OpsMgr 2012 Sizing Helper is an interactive document designed to assist you with planning & sizing deployments of System Center 2012 Operations Manager. It helps you plan the correct amount of infrastructure needed for a new OpsMgr 2012 deployment, removing the uncertainties in making IT hardware purchases and optimizes cost. A typical recommendation will include minimum hardware specification for each server role, topology diagram and storage requirement. Microsoft Link
    System Center 2012 Operations Manager (SCOM) Visio Stencil  Design  System Center 2012 Operations Manager (SCOM) Visio Stencil    Link

    Let me please know if I’m missing some other great OM2012 tools.

  • Retrieving MMS 2013 Content Sessions using PowerShell

    In between my PowerShell activities, I’ll visiting the Microsoft Management Summit in Las Vegas next week. This week I’m delivering a PowerShell workshop in the Netherlands, and when returning from MMS I’ll again be teaching a PowerShell workshop before going to the PowerShell Summit in Redmond. So it’s going to be a busy month traveling to the US and back.

    While preparing my PowerShell workshop this week I wanted to have a look at the sessions for MMS 2013 and went to the Sessions catalog on the www.2013mms.com website.

    image

    Because I could not find an option to export all sessions to a Excel sheet, I created a PowerShell script which retrieves all sessions and makes it possible to export the result to a csv file using the Export-CSV cmdlet.

    If you want you can do many more fun things with the results, let me know what you created.

    Remarks:

    • Retrieving the website and getting the HTML Tag name elements can take some time to finish, be patient!
    • You need PowerShell v3 to run this script.
    
    #######################################################################################################################                        
    # Description:   Get-MMS2013 Sessions. This script retrieves the sessions from the http://www.2013mms.com website
    #                You need to have access to the website to retrieve the sessions. 
    #                Example usage: Export all sessions to cvs file using the export-csv cmdlet.
    #                Get-MMS2013Session.ps1 | export-csv -path c:\temp\mms2013sessions.csv -NoTypeInformation                
    # Author:        Stefan Stranger (Microsoft)            
    # Example usage: Run Get-MMS2013Session.ps1
    # Disclamer:     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.
    # Date:          04-02-2013                        
    # Name:          Get-MMS2013Session.ps1            
    # Version:       v1.000 - 04-02-2013 - Stefan Stranger - initial release
    ########################################################################################################################
    
    
    $mms = Invoke-WebRequest -Uri "http://www.2013mms.com/Topic/List?format=html&Keyword=&Categories=&Timeslot=&Speaker=&Day=&Start=&Finish=&oc=&take=-1&skip=0&_=1364899913083"
    $sessions = $mms.ParsedHtml.getElementsByTagName("div") | Where "classname" -match "^topic" | Select -ExpandProperty InnerText
    
    foreach ($session in $sessions) {
        #$count++; $count; $session;
        $session = $session.split("`n",6);
        #Check Sessiontype.
        Switch -Wildcard ($session[0]) {
            '*-B*' {#Check for missing products
                if ($session[4] -like "Product(s)*"){
                $session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = $session[1]
                    Track = $session[2]
                    SessionType = $session[3]
                    Product= $session[4]
                    Description = $session[5]
                } #End pscustomobject
                } #end call
                } #end if
                else
                {
                    $session | &{
                    [pscustomobject]@{
                    Session = $session[0]
                    Speaker = $session[1]
                    Track = $session[2]
                    SessionType = $session[3]
                    Product= ""
                    Description = $session[4]
                    } #End pscustomobject
                    } #end call
                } #end else
            }
            '*-L*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = ""
                    Track = $session[1]
                    SessionType = $session[2]
                    Product = ""
                    Description = $session[3]
                } #End pscustomobject
                } #end call
            }
            '*-IL*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = ""
                    Track = $session[1]
                    SessionType = $session[2]
                    Product = ""
                    Description = $session[3]
                } #End pscustomobject
                } #end call
            }
            'BO*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = ""
                    Track = ""
                    SessionType = $session[1]
                    Product = ""
                    Description = $session[2]
                } #End pscustomobject
                } #end call
            }
            'EXM*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = $session[1]
                    Track = ""
                    SessionType = $session[2]
                    Product = $session[3]
                    Description = $session[4]
                } #End pscustomobject
                } #end call
            }
            'MMS*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = $session[1]
                    Track = ""
                    SessionType = $session[2]
                    Product = ""
                    Description = $session[3]
                } #End pscustomobject
                } #end call
            }
            'KEY*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = $session[1]
                    Track = ""
                    SessionType = $session[2]
                    Product = ""
                    Description = $session[3]
                } #End pscustomobject
                } #end call
            }
            'MSP*' {$session | &{
                [pscustomobject]@{
                    Session = $session[0]
                    Speaker = ""
                    Track = ""
                    SessionType = $session[1]
                    Product = ""
                    Description = $session[2]
                } #End pscustomobject
                } #end call
            }
            Default {#Write-Host "$($session[0]) session id not specified in script" -ForegroundColor Red;
                    $session | &{
                        [pscustomobject]@{
                        Session = $session[0]
                        Speaker = $session[1]
                        Track = ""
                        SessionType = $session[2]
                        Product = ""
                        Description = "$($session[0]) session id not specified in script"
                } #End pscustomobject
                } #end cal
                        }
    
        }
    }
    
    
    

    image

     

    image

    Do you want to contact me during MMS or the PowerShell summit just send me a message on Twitter and who knows we can talk about Operations Manager or PowerShell or some other great topic!

  • New tool for MP Authoring

    As may or may not have read on the MP Author website Microsoft has decided to partner with Silect to create a MP Authoring tool targeted to IT Pros. This tool is called MP Author and is completely free for all System Center Customers and will be the tool we recommend to IT Pros who need to do MP Authoring.

    It replaces previous tools we have piloted such as the Visio Authoring Tool which will be no longer recommended or supported.

    Software Prerequisites

    •   System Center Operations Manager Console 2012 or above must be installed

    In this blog post I walk you through the installation steps after you have downloaded the MP Author tool and some MP creation steps. You can also review the BridgeWays_MP_Author_Installation_Guide and BridgeWays_MP_Author_User_Guide PDF Guides that come with the installation.

    Steps:

    1. Unzip MPAuthor.zip file
    2. Run MPAuthorSetup.exe

    Step 1. Unzip File

    image

    image

    Steps 2. Run MPAuthorSetup.exe

    image

    Click Yes

    image

    Click Next

    image

    Accept License Agreement and click Next

    image

    Enter Folder to store application and click Next

    image

    Click Install

    image

    Hit finish

    Open MP Author as an Admin

    image

    image

    image

    image

    This will help you get started with the creation of your Management Packs.

    Let’s create a new Management Pack with an Event Monitor.

    Steps:

    1. Click on New in MP Author Console
    2. Follow the Wizard
    3. Save MP
    4. Import Management Pack

    image

    image

    Click on Next

    image

    Enter the config needed for the Manifest section of the MP and click on Next.

    image

    Enter folder to store you MP and click on Next

    image

    Add needed references and click Next

    image

    Choose the Template you want to use for creating your MP and click on Next

    image

    Define the Role the MP will monitor

    Let’s only monitor Gold servers, which we retrieve from a registry value.

    image

    image

    Click on Browse

    image

    Select Registry we want to use and click on OK.

    image

    image

    Identify registry target and click on Next

    image

    Click on Next

    image

    Enter expression and click on Next

    image

    Enter Discovery Schedule and click Next

    image

    Click on Finish

    Continue with the Monitor creation

    image

    Click Next

    image

    image

    Select Event Monitor

    image

    Click Next

    image

    Specify Unhealthy Event and click Next

    image

    Specify Health timer or Event and click Next

    image

    Click Next

    image

    Specify Health States and click Next

    image

    Specify if an Alert needs to be created and Click Next

    image

    Click Finish

    image

    You can add more monitors are click Next to continue

    image

    Choose Rollup Algorithm and click Next

    image

    Click Finish to finalize MP.

    image

    We can verify the MP using the tools and we can also run the Best Practices Analyzer.

    image

    image

    Let’s import the MP

    image

    image

    image

    image

    image

    We can check in the Discovered Inventory for the Target we specified in the MP.

    image

    And finally an Alert is shown after creating the Event in the Eventlog.

    image

    Hope you enjoy this new tool.

    References:

  • Remote Desktop Connection Manager from Microsoft

    Source: Bink.nu

    Last month we released our Remote Desktop Connection Manager on MS Download. I’v been using this great tool for quite some time now and I would recommend taking a look.

    This is really a great Remote Desktop Connection tool.

    image

     

    image

  • Not being able to blog lately

    It has been some time ago I posted my last blogpost, because the last couple of week have been quite emotional. My mother has been diagnosed with Lymphoma and had her first chemo last week. I tried to support my mum as much as possible and we got some great help from friends and relatives in these difficult times.

    We all hope the chemo will help cure my mum, but for now we can only hope for the best. So if you wondered why it has been so quiet on this blog and on twitter this is the reason.

    Stefan

  • Passed OpsMgr Configuring Exam (070-400)

    Today I did my Microsoft System Center Operations Manager Configuring Exam and passed with a score of 980 points. Still room for improvement…

    http://twitpic.com/1lc8

    I thought it was easy, but I work with the product every day and I still love it ;-)

  • System Center Desktop Wallpaper

    Source: internal

    A colleague of mine (André) likes to have simple clean Desktop Wallpapers and he just found a System Center Desktop Wallpaper. And I like it.

    Maybe you like it too. You can download it from my SkyDrive.

  • OpsMgr 2007: Parameters Explained

    Some time ago I showed you can use PowerShell to create Events for OpsMgr 2007. And according to the comments quite some people have questions about Event parameters. After creating the first version of the PowerShell Create Events for OpsMgr 2007 script, Ken added some functionality and one was modifying the question to not only add a EventLog Description but also a EventLog Parameter.

    I found some info on MOM 2005 parameters on Rory McCaw’s weblog, but except that article I could not find much info on Event Log parameters. So hopefully this will explain what parameters are and how they can be used in OpsMgr 2007.

    EventLog Parameters in the Events

    Every Windows event has description text that is filled in by the values of different parameters. You can find the Eventlog parameters of an event by using the Log Parser. (if you know an easier way on Windows 2003 Servers let me know). Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

    Example of EventLog Parameters in an Eventlog:

    C:\Program Files\Log Parser 2.2>LogParser.exe "SELECT Top1 Strings AS Parameters FROM Application WHERE EventID=301"

    Result:
    image_thumb

    So in this example you can use four parameters in your OpsMgr Rules or Monitor.

    Event Parameters in OpsMgr 2007

    Eventlog Parameters can be used in OpsMgr Rules and Monitors. An example where you can find EventLog Parameters used is the Windows Activation State Monitor in the Windows Server 2003 MP. This is a 3 State Event Log Monitor and this monitor looks for EventLog Parameters and the values found in the Eventlog change the state of the monitor.

    Healthy:    Look for EventId 1006 in Application Log of Source Windows Product Activation
    Warning: Look for EventId 1005 in Application Log of Source Windows Product Activation and Params/Param[1] > 6 =< 15
    Critical:   Look for EventId 1005 in Application Log of Source Windows Product Activation and Params/Param[1] =< 6

    image_thumb10

    You can use the PowerShell Create Events script from Ken to test your monitors or rules with with one EventLog parameter. So it won’t work if you need to test a Rule or Monitor which uses more than one parameter in the Eventlog.

    So if you want to test the Windows Activation State Monitor and want to Change the State to Critical, you need to create an Event with the next values:

    EventID 1005
    Source Windows Product Activation
    Type Error
    Description Your Windows product has not been activated with Microsoft yet. Please use the Product Activation Wizard within <number> days.

    More info about this event can be found on EventID.Net

    image

  • AddToDistList Tool - Adding a computer to the Distribution list on a RunAs Account

    Some weeks ago I saw a question about how to use PowerShell for the ApproveCredentialForDistribution method. This Method Approves a secure credential for distribution to a list of MonitoringObject objects or PartialMonitoringObject objects. Calling this method adds the specified list to the already existing approved list in the system.

    You use this method when you add a computer to the Run As Account.

    clip_image002[4]

    clip_image002

     

    But what if you want to add not one but much more Computers to a Distribution List? In the OpsMgr Console you need to select each computer one-by-one and add the computer to the list. Would not it be cool if we could use PowerShell or some commandtool to create a script to do it automatically for us?

    On the Technet System Center Forum website there is also a discussion about this topic. So I looked at the method on MSDN and tried to get this working in PowerShell. But till now I’ve not been able to get this working in PowerShell Sad smile So I created a Console App in Visual Studio 2010 which seems to work ok. I’ll add the source code so you can have a look how I  created the Console App. I also used nConsoler, which helped with the parsing of arguments in the console application. And finally I used ILMerge to merge the nConsoler dll in a single .NET assembly.

    Program.cs:

    using System;
    using System.Text;
    using Microsoft.EnterpriseManagement;
    using Microsoft.EnterpriseManagement.Configuration;
    using Microsoft.EnterpriseManagement.ConnectorFramework;
    using Microsoft.EnterpriseManagement.Monitoring;
    using Microsoft.EnterpriseManagement.Monitoring.Security;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Diagnostics;
    using System.Xml;
    using System.Security;
    using Microsoft.EnterpriseManagement.Administration;
    using NConsoler; //http://nconsoler.csharpus.com/
    
    namespace OpsMgrApproveCredentialForDistribution
    {
        class Program
        {
            static void Main(string[] args)
            {
                //NConsoler
                Consolery.Run(typeof(Program), args);
            }
    
            [Action]
            public static void DoWork(
                [Required(Description="Enter RMS Server name")]
                string RMS,
                [Required(Description="Enter RunAs Account Name")]
                string RunAsAccount,
                [Required(Description = "Enter FQDN OpsMgr Agent\n" +
                    "\nExample: AddToDistList.exe opsmgrrms.contoso.com om_sql_mon opsmgragent.contoso.com" +
                    "\nAdding a computer to the Distribution list on a RunAs Account application for OpsMgr 2007" +
                    "\nemailname@hotmail.com\n" +
                    "\nProvided 'AS IS' without warranty of any kind")]
                string OpsMgrAgent)
            {            
                Console.WriteLine("OpsMgrApproveCredentialForDistribution - Version 1.3 - Compiled March 5, 2011");
                Console.WriteLine("http://blogs.technet.com/stefan_stranger");
    
    
                    // Connect to the sdk service on the RMS
                    //ManagementGroup localManagementGroup = new ManagementGroup(strRMS);
                    ManagementGroup localManagementGroup = ConnectMG(RMS);
                    if (localManagementGroup == null)
                    {
                        Console.WriteLine("Failed to connect to Root Management Server " + RMS);
    
                    }
                    else
                    {
                        MonitoringSecureDataCriteria runAsAccountCriteria;
                        ReadOnlyCollection<MonitoringSecureData> runAsAccounts;
    
                        Console.WriteLine("RunAs Account Username:" + RunAsAccount);
    
                        runAsAccountCriteria = new MonitoringSecureDataCriteria("UserName LIKE " + "'" + RunAsAccount + "'");
                        runAsAccounts = localManagementGroup.GetMonitoringSecureData(runAsAccountCriteria);
    
                        if (runAsAccounts.Count == 0)
                            throw new InvalidOperationException("Error! RunAs Account not found: " + RunAsAccount);
    
                        MonitoringSecureData account = runAsAccounts[0];
                        List<MonitoringObject> list = new List<MonitoringObject>();
    
                        // Fully qualified name of the agent-managed computer.
                        ManagementGroupAdministration admin = localManagementGroup.GetAdministration();
    
                        string query = "Name = '" + OpsMgrAgent + "'";
                        AgentManagedComputerCriteria agentCriteria =
                            new AgentManagedComputerCriteria(query);
                        ReadOnlyCollection<AgentManagedComputer> agents =
                            admin.GetAgentManagedComputers(agentCriteria);
                        if (agents.Count != 1)
                            throw new InvalidOperationException("Error! OpsMgr Agent not found: " + OpsMgrAgent);
    
    
                        //Add OpsMgr Agent to list
                        list.Add(agents[0].HostedHealthService);
                        localManagementGroup.ApproveCredentialForDistribution((ISecuredData)account, list);
                        Console.WriteLine("OpsMgr Agent " + OpsMgrAgent + " added to distribution list");
                }
            
    
       }
    
            private static ManagementGroup ConnectMG()
            {
                throw new NotImplementedException();
            }
    
            //Connect to SDK Service on Root Management Server
            private static ManagementGroup ConnectMG(String RMS)
            {
                Console.WriteLine("Connect to Root Management Server:" + RMS);
                try
                {
                    ManagementGroupConnectionSettings connectionSettings = new ManagementGroupConnectionSettings(RMS);
                    ManagementGroup localManagementGroup = ManagementGroup.Connect(connectionSettings);
                    if (!localManagementGroup.IsConnected)
                    {
                        throw new InvalidOperationException("Not connected to an SDK Service.");
                    }
                    Console.WriteLine("Connected to Management Group {0}", localManagementGroup.Name);
                    return localManagementGroup;
                }
                catch (Exception exception)
                {
                    Console.WriteLine("\nConnection failed. " + exception.Message);
                    if (exception.InnerException != null)
                    {
                        Console.WriteLine(exception.InnerException.Message);
                        return null;                    
                    }
                }
                    return null;
                    
            }
            
        }
    }
     
    Ok let’s have a look how it works. 
    Scenario:
    We will be adding the OpsMgr Agent OpsMgrDC01.stranger.local to the SQL MP Monitoring Account Run As Account. (yes this is just an example there is no SQL running on my Domain Controller) Winking smile
    Current Config SQL MP Monitoring Run As Account:
    imageimage
     
    Step 1: Install AddToDistList console application on machine where OpsConsole is installed.
    Just copy the AddToDistList.exe to a folder of your choice.
    image
     
    Step 2. Open the AddToDistList.exe from command prompt.
    image

    As you see it needs 3 parameters:

    • RMS Name
    • RunAs Account Name (domain account name)
    • FQDN OpsMgr Agent

     

    When we want to add the OpsMgrDC01.stranger.local OpsMgr Agent to the SQL MP Monitoring Account Run As Account we need to run the following:

    AddToDistList.exe opsmgrrms.stranger.local om_sql_mon opsmgrdc01.stranger.local

    image

    Let’s check if the opsmgrdc01 agent is added to the distribution list.

    Yes! It worked Smile

    image

     

    Now you could create a script that pull’s the names of the computers that need to be added to the Distribution List from a text file and call’s the AddToDistList console application.

    Download AddToDistList.exe

    Download SourceCode

    Disclamer:

    This is provided as a sample, no support is implied. Provided 'AS IS' without warranty of any kind. I wrote it for me initially.I'm not a developer, and don't profess to be either; just to set your expectations Smile

    Tested on OpsMgr 2007 R2.

  • OpsMgr 2012: Update Rollup 3 ships, and my experience installing it

    Because Kevin Holman has not published a blog article on the latest release of the Update Rollup 3 for System Center 2012 for Operations Manager 2012 I thought why should not I do it this time Smile

    And to be honest this time was a little different then I’ve implemented updates in years. Why?

    Because this UR3 is automatically installed via Windows Update if you have enabled Windows Updates on all your OpsMgr 2012 machines off course.

    Let’s first have a look at what has been fixed in this UR3 for System Center Operations Manager 2012 (KB2750631)

    • Issue 1
      When you use the 32-bit version of Windows Internet Explorer to start a web console, the Microsoft.EnterpriseManagement.Presentation.Controls.SpeedometerGaugeUIController controller does not work correctly.
    • Issue 2
      When you run a Windows PowerShell cmdlet, you receive the following error message: 
      Get-BPAModel is not recognized as the name of a cmdlet.
    • Issue 3
      When you try to change a URL in the "web application availability monitoring" template instance, the change is not applied.

    Not that much has been fixed in the UR3 but we still want to check if our machines have these fixes installed and if we need to do some steps our selves.

    How do I check if these fixes have been installed via Windows Update?

    That’s pretty easy, just go to your OpsMgr 2012 servers and open Windows Update and have a look at the Update History

    Let’s have a look at one of my Management Servers:

    image

    You can also use PowerShell if you want using the following commands:

    Get-Content $env:windir\windowsupdate.log |  
        Where-Object { $_ -like '*successfully installed*Update Rollup 3 for System Center 2012*'} |  
            Foreach-Object { $_ | select @{L="InstallDate";E={$_.Split("`t")[0]}}, @{L="Description";E={$_.Split("`t")[16]}} } |
                Format-Table * -Wrap

     

    image

    And this is the result on my other Management Server:

    image

    You can also look at the file version for some of the updated files, just like Kevin showed you in his previous posts on Update Rollups.

     

    Checking the updated files for the Management Server Role:

    Get-ItemProperty -Path "c:\Program Files\System Center 2012\Operations Manager\Server\*.dll" | select -ExpandProperty VersionInfo | where {$_.FileVersion -eq "7.0.8560.1036"} | Format-List FileName, FileVersion

    image

    You should see files with a File Version of 7.0.8560.1036

    This means that the Management Server UR3 update has been installed on this Management Server.

    Checking the updated files for the Web Console Role:

    Get-ItemProperty -Path "c:\Program Files\System Center 2012\Operations Manager\WebConsole\WebHost\bin\*.dll" | select -ExpandProperty VersionInfo | where {$_.FileVersion -eq "7.0.8560.1036"} | Format-List FileName, FileVersion

    image

     

    Checking the updated files for the Console Role:

    Get-ItemProperty -Path "c:\Program Files\System Center 2012\Operations Manager\Console\*.dll" | select -ExpandProperty VersionInfo | where {$_.FileVersion -eq "7.0.8560.1036"} | Format-List FileName, FileVersion

    image

    Checking the updated files for the Console Role:

    Get-ItemProperty -Path "c:\\Program Files\System Center 2012\Operations Manager\Reporting\Tools\*.*" | select -ExpandProperty VersionInfo | where {$_.FileVersion -eq "7.0.8560.1036"} | Format-List FileName, FileVersion

    image

    Checking if the following Management Packs are updated:

    The Management Packs for UR3 can be found in the following folder:

    C:\Program Files\System Center 2012\Operations Manager\Server\Management Packs for Update Rollups

    In this folder you find the following Management Pack files:

    • Microsoft.SystemCenter.DataWarehouse.Library.mp (version 7.0.8427.1)

    • Microsoft.SystemCenter.Visualization.Library.mpb (version 7.0.8560.1036)

    • Microsoft.SystemCenter.WebApplicationSolutions.Library.mpb (version 7.0.8560.1036)

    When you check if these Management Packs are already installed this does not seem the case.

    Get-SCOMManagementPack | where {($_.Name -eq "Microsoft.SystemCenter.DataWarehouse.Library") -or ($_.Name -eq "Microsoft.SystemCenter.Visualization.Library") -or ($_.Name -eq "Microsoft.SystemCenter.WebApplicationSolutions.Library")} | ft Name, Version -AutoSize

     

    image

     

    So we need to install the latest Management Packs Microsoft.SystemCenter.Visualization.Library and Microsoft.SystemCenter.WebApplicationSolutions.Library from the UR3 update manually using PowerShell.

    Remark: During one the previous Update Rollups my Microsoft.SystemCenter.DataWarehouse.Library.mp (version 7.0.8427.1) was already updated to version 7.0.8427.1.

    PS C:\Program Files\System Center 2012\Operations Manager\Server\Management Packs for Update Rollups> Get-ChildItem -Filter *.mpb | Import-SCOMManagementPack -PassThru

    image

    Latest MPs have been installed.

     

    Checking if the Agents are updated with the latest updates:

     

    Check the Pending Management Pane for Agents that need an update.

    image

    Approve Agent using PowerShell

    Get-SCOMPendingManagement | Approve-SCOMPendingManagement –ActionAccount (Get-Credential)

     

     

    image

    image

    image

    Now I only need to install manually the UR3 update on my Agent in my DMZ.

    Have fun with UR3!

    Links:

  • Windows Phone Push Notifications for your OpsMgr Alerts - Part 1

    Did you know you can easily create your own Windows Phone Push Notifications using the Notify My Windows Phone app?

    NMWP is a platform that helps you push information to virtually any Windows Phone 7 (and 8) device you own.

    What do you need to get started?

    1. Windows Phone 7 or 8
    2. The NMWP app from the Microsoft Store ($1.99)
    3. NMWP Api key
    4. PowerShell script to call the Web API

     

    First we need to install the The NMWP app from the Microsoft Store on our Windows Phone. Open the Windows Store app on your Windows Phone and install the app.

    nmwp7

    Next we need to Sign up at http://www.nmwp7.com/user/register and create a username and password.

    image

     

    After registering you need to enter your username and password at the Notify my Windows Phone app on your Windows Phone.

    nmwp7_2

    And at last we need to request an API key on the http://www.nmwp7.com/user/apikeys website.

    image

     

    After requesting the API key you can test the key using the Send testmessage button.

    image

    Hopefully now everything is working as expected.

    Testing Notify My Windows Phone from PowerShell

    If you look at the API help it’s pretty simple to call the API. With PowerShell v3 you can use the Invoke-WebRequest cmdlet to call the Web API.

    A simple PowerShell script to call the Web API can look something like this:

    #Requires -Version 3
    
    #######################################################################################################################                        
    # Using the Notify my Windows Phone API using PowerShell                        
    # Author: Stefan Stranger            
    # Disclamer: 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.
    # Date:        01-05-2012                       
    # Name:     NotifyMyWindowPhone.ps1            
    # v0.01 -     01-05-2012 - Stefan Stranger - sstranger's initial release               
    ########################################################################################################################
    
    # Enter your own API Key from http://www.nmwp7.com/user/apikeys
    $apikey = "[enter here your api key]"
    
    # Enter the name of the application the notification originates from. 
    $application = "WindowsPowerShell"
    
    # Enter The event that occured. Depending on your application, this might be a summary, subject or a brief explanation.
    $event = "Push Message sent from PowerShell"
    
    # The full body of the notification. 
    $description = "This message was sent as a test"
    
    # An optional value representing the priority of the notification.
    $priority = "-2"
    
    # Specifies the responsetype you want. You can currently choose between JSON or XML (default)
    $type = "json"
    
    $uri = "http://notifymywindowsphone.com/publicapi/notify?event=$event&priority=$priority&application=$application&description=$description&apikey=$apikey&type=$type"
    
    Invoke-WebRequest -Uri $uri

    If you run above PowerShell script you will see the following result returned in your console.

    image

    Now you would see the push notification on your Windows Phone.

    nmwp7_3

    In my next blog post I’ll explain how you can use above to create Windows Phone Push Notifications for your OpsMgr Alerts using the Notification Command Channel.

    Have fun!

  • PowerShell Sub-Expressions

    This week I’m teaching a PowerShell Workshop and I get often asked why it is necessary to use a sub-expression, a $ sign followed by a set of parenthesis ().

    Compare the following difference:

    1 $service = Get-Service -Name Spooler 2 #Without the use of Sub-Expressions 3 "The Spooler Service is currently $service.status" 4 5 #Without the use of Sub-Expressions but extra step 6 $status = $service.status 7 "The Spooler Service is currently $status" 8 9 #With the use of Sub-Expressions 10 "The Spooler Service is currently $($service.status)"

    image

    By using sub-expressions you are able to extract the value of a property for displaying. This saves the extra step of creating an additional variable to contain the value of the property before displaying it.

    Hope this helps.

  • Compare two different csv files using PowerShell

    Today I needed to compare two csv files with results from SQL queries from the OperationsManager database and the OperationsManagerDW database. I run the SQL queries on both OperationsManager databases and saved the result to a csv file. Now I needed to quickly compare the results from both csv files, and what better way than to use PowerShell.

    Here is an example how you can use PowerShell to quickly compare two csv files:

    First some example CSV files:

    Example CSVFile1.csv

    ManagementPackId,MPFriendlyName,MPName,mp.MPVersionDependentId,MPLastModified,MPKeyToken,ContentReadable
    3A7609F3-A5AB-F205-5001-010EE387DD28,Customer - Exchange 2007 MP overrides,Customer.Exchange.MP.overrides,5D49AADA-DFEE-40DC-9A32-2758FC71B426,2011-01-06 16:39:57.517,NULL,1
    49C911AC-337C-CD94-DD13-021E2CFDDAB0,Customer - SCOM MS,Customer.SCOM.MS,9FA54A57-B123-44AE-A9AB-ED1A1C4CDB35,2011-01-27 09:16:28.100,NULL,1
    C0A4183F-4318-CB0C-EF5A-054B32AE33B4,Windows Server 2000 Operating System Overrides,Windows.Server.2000.Operating.System.Overrides,6293AED6-DE8F-462E-AD54-1F83F2E33F82,2011-02-04 14:38:19.330,NULL,1
    3DFAC27F-8551-B71B-7DD2-30156A31CD92,Customer - Citrix Beheer - WIS Servers Events,Customer.Citrix.Beheer.WIS.Servers.Events,4496E575-C63C-4B45-BEF7-6216668264F7,2010-12-06 01:54:15.963,NULL,1
    3AFE86A8-827C-CDB6-9A84-32C67483C3D1,Windows cluster management monitoring - overrides,Windows.cluster.management.monitoring.overrides,243D4B09-9455-4737-9880-399CF2700CF4,2011-02-04 16:07:11.377,NULL,1
    6569E210-F188-EEF7-05CA-331859F4D8C6,Customer - Citrix Beheer,Customer.Citrix.Beheer,8109BB67-C923-4814-A1DB-F2A386B2389B,2011-01-17 13:58:08.690,NULL,1
    8BDC857A-7F32-40A7-E5C2-4583E263B290,Customer - ISA server 2006,Customer.ISA.server,68F24CBA-B6C7-474B-A09B-03B0D730609B,2011-01-07 10:56:51.290,NULL,1
    C39E8EF5-5E04-9CAE-F467-61D87ACD5E9E,Customer - Windows Server - SCCM,Customer.Windows.Server.SCCM,7BB1925D-007A-4621-BAD3-56F87B49C4C8,2011-01-17 13:02:28.880,NULL,1
    A2B5CA86-96F7-F4CA-2152-63274CEF3336,Customer - Sharepoint Server,Customer.Sharepoint.Server,26E07753-0740-450F-972C-6A16C2099C12,2011-01-06 07:26:36.533,NULL,1
    5BC992B2-96F6-E192-6E92-65FB5EC0CE5E,Customer - SQL Server (Monitoring),Customer.SQL.Server.Monitoring,2618C5C0-D89F-4E86-8259-FD7809D75E7C,2011-02-07 14:12:14.613,NULL,1
    E4056BA9-CFC7-2D04-FF9B-67084CC15E83,Customer - Print Servers,Customer.Print.Servers,C336C3FD-CF15-4319-A33E-00F4BF2A390D,2010-11-24 10:14:22.660,NULL,1
    3EECB872-CC4A-62BC-EA39-855EF594852D,Customer - Print Beheer Menu MP,Customer.Print.Beheer.Menu.MP,6F12D09D-0A55-40BA-A320-B571E9554ADE,2010-12-21 12:49:53.603,NULL,1
    A2D688EC-8AE1-C4AF-A485-8564C214D292,Customer - Arcserve MP,Customer.Arcserve.MP,7AECFE66-51F6-4174-B84C-E918140F37F2,2010-12-03 11:51:39.080,NULL,1
    A3542697-E0E7-E382-D40B-86ADEC512D79,Windows Server 2008 Operating System (Monitoring) Overrides,Windows.Server.2008.Operating.System.Monitoring.Overrides,20BCC6DC-F928-4108-B70F-873639A0448A,2010-12-16 12:16:40.800,NULL,1
    070A0205-56D6-FF84-688A-8A216A47A949,Customer - Fileservers Dienst,Customer.Fileservers.Dienst,7DDF2381-3B13-4971-9E91-6656075C2E60,2010-12-22 09:26:50.683,NULL,1
    98701ABB-AF93-7E5A-D121-9A18E0037CE8,Customer - DSA & PKI Gateways,Customer.DSA.PKI.Gateways,95B49F67-9514-4E80-991D-B3CF4EA2632F,2010-12-20 11:38:44.697,NULL,1
    FA4FDEAF-E107-8AA3-BD2C-9E29C58C0C53,Customer - PKI Management,Customer.PKI.Management,6B677888-07F1-4725-BA3F-E742B20FA9C4,2011-01-27 08:45:23.153,NULL,1
    51DA566A-1AC1-5DC9-3F66-A11FC439357C,nworks VMware Virtual Enterprise Monitoring MP,nworks.VMware.VEM,599A587E-3357-A127-50EF-198F04365ADA,2010-11-23 11:10:29.243,65c40f14a98ce59b,1
    512DB9E6-D21A-2E4F-E987-A28BDE8F940B,Customer - Exchange availability,Customer.Exchange.availability,1D0DDA6B-9ED2-48C0-BFEE-1538DA9AE16F,2010-12-27 10:10:30.707,NULL,1
    DD81FA7E-73BF-332B-C4B6-A767BB514BE8,Customer - Connect Direct,Customer.Connect.Direct,9C6BB3FD-6582-4F18-B18C-7BBE4DB9FCA6,2011-01-31 13:47:15.613,NULL,1
    155A8BBB-C6D2-C706-DD1C-B7EFCCCC0E81,Customer - AD Beheer,Customer.AD.Beheer,CF036BAA-47C0-4D09-A2F4-25B3DC1F78B9,2011-01-05 13:17:15.520,NULL,1
    E2296ED5-DDBC-EBC7-3881-C5288ADAA7CF,Microsoft Exchange Server 2010 Management Pack,Microsoft.Exchange.2010,AB06EB14-EAF1-0F0B-04B8-F1CDD33F4ACC,2011-02-04 09:02:29.607,31bf3856ad364e35,1
    9E138797-AE1C-AF6E-E61B-D110253B417C,Engyro Connector TEC,Engyro.Connector.TEC.MP,76306617-5F13-42EB-9F3B-B948F18DC4D8,2010-11-23 11:29:55.980,NULL,1
    A3C3E706-795F-BF80-DFC2-DBB4BDDFA919,Customer - ACS Management Pack,Customer.ACS.Management.Pack,D7C4F7A2-B18D-454F-8615-22CEC4EFDFCA,2011-01-04 12:30:01.593,NULL,1
    7C2A6181-B7B9-89C2-6FC3-EDB760FCEFC1,Microsoft Exchange Server 2007 CAS Monitoring - Override,Microsoft.Exchange.Server.CAS.Monitoring.Override,BA79A086-E992-4AB7-B4B6-933FB8AD1211,2011-01-07 12:39:36.870,NULL,1

     

    Example CSVFile2.csv

    ManagementPackId,MPFriendlyName,MPName,mp.MPVersionDependentId,MPLastModified,MPKeyToken,ContentReadable
    3A7609F3-A5AB-F205-5001-010EE387DD28,Customer - Exchange 2007 MP overrides,Customer.Exchange.MP.overrides,5D49AADA-DFEE-40DC-9A32-2758FC71B426,2011-01-06 16:39:57.517,NULL,1
    49C911AC-337C-CD94-DD13-021E2CFDDAB0,Customer - SCOM ,Customer.SCOM,9FA54A57-B123-44AE-A9AB-ED1A1C4CDB35,2011-01-27 09:16:28.100,NULL,1
    C0A4183F-4318-CB0C-EF5A-054B32AE33B4,Windows Server 2000 Operating System Overrides,Windows.Server.2000.Operating.System.Overrides,6293AED6-DE8F-462E-AD54-1F83F2E33F82,2011-02-04 14:38:19.330,NULL,1
    F37D0C95-F313-4EC9-5385-0F41BFCFE55D,Customer Custom Monitoring,Customer.Custom.Monitoring,44597F97-6FD4-4D2E-B01E-5CDB9B218E50,2011-01-27 08:52:20.377,NULL,1
    75E3375E-B1CD-4641-E86B-2664A7E7E7C2,Customer - Microsoft Exchange 2010 Override MP,Customer.Microsoft.Exchange.Override.MP,6DC9439A-BD4C-46C0-8D2F-080029042A6D,2011-02-04 11:12:40.857,NULL,1
    3DFAC27F-8551-B71B-7DD2-30156A31CD92,Customer - Citrix Beheer - WIS Servers Events,Customer.Citrix.Beheer.WIS.Servers.Events,4496E575-C63C-4B45-BEF7-6216668264F7,2010-12-06 01:54:15.963,NULL,1
    3AFE86A8-827C-CDB6-9A84-32C67483C3D1,Windows cluster management monitoring - overrides,Windows.cluster.management.monitoring.overrides,243D4B09-9455-4737-9880-399CF2700CF4,2011-02-04 16:07:11.377,NULL,1
    6569E210-F188-EEF7-05CA-331859F4D8C6,Customer - Citrix Beheer,Customer.Citrix.Beheer,8109BB67-C923-4814-A1DB-F2A386B2389B,2011-01-17 13:58:08.690,NULL,1
    B5FE879F-CD35-DD9A-7464-36401ABB9205,Microsoft Exchange 2010 Report Library,Microsoft.Exchange.2010.Reports,112EA102-A45A-9AA9-C84D-1ED9A56E8C61,2011-02-04 10:31:14.137,31bf3856ad364e35,1
    DA187E72-B9D7-9E16-D098-3B0A624DC38C,My Default Management Pack,Microsoft.SystemCenter.OperationsManager.DefaultUser,497CE20F-02AF-417E-97B1-363F311CF739,2011-02-03 16:37:16.093,NULL,1
    8BDC857A-7F32-40A7-E5C2-4583E263B290,Customer - ISA server 2006,Customer.ISA.server,68F24CBA-B6C7-474B-A09B-03B0D730609B,2011-01-07 10:56:51.290,NULL,1
    C39E8EF5-5E04-9CAE-F467-61D87ACD5E9E,Customer - Windows Server - SCCM,Customer.Windows.Server.SCCM,7BB1925D-007A-4621-BAD3-56F87B49C4C8,2011-01-17 13:02:28.880,NULL,1
    A2B5CA86-96F7-F4CA-2152-63274CEF3336,Customer - Sharepoint Server,Customer.Sharepoint.Server,26E07753-0740-450F-972C-6A16C2099C12,2011-01-06 07:26:36.533,NULL,1
    5BC992B2-96F6-E192-6E92-65FB5EC0CE5E,Customer - SQL Server (Monitoring),Customer.SQL.Server.Monitoring,2618C5C0-D89F-4E86-8259-FD7809D75E7C,2011-02-07 14:12:14.613,NULL,1
    E4056BA9-CFC7-2D04-FF9B-67084CC15E83,Customer - Print Servers,Customer.Print.Servers,C336C3FD-CF15-4319-A33E-00F4BF2A390D,2010-11-24 10:14:22.660,NULL,1
    336987CD-60EF-5014-F384-7D37DE784858,Nworks Overrides,Nworks.Overrides,5EF45858-0DC1-4E67-9AFD-F70A2446CCA9,2011-01-25 10:20:27.143,NULL,1
    3EECB872-CC4A-62BC-EA39-855EF594852D,Customer - Print Beheer Menu MP,Customer.Print.Beheer.Menu.MP,6F12D09D-0A55-40BA-A320-B571E9554ADE,2010-12-21 12:49:53.603,NULL,1
    A2D688EC-8AE1-C4AF-A485-8564C214D292,Customer - Arcserve MP,Customer.Arcserve.MP,7AECFE66-51F6-4174-B84C-E918140F37F2,2010-12-03 11:51:39.080,NULL,1
    A3542697-E0E7-E382-D40B-86ADEC512D79,Windows Server 2008 Operating System (Monitoring) Overrides,Windows.Server.2008.Operating.System.Monitoring.Overrides,20BCC6DC-F928-4108-B70F-873639A0448A,2010-12-16 12:16:40.800,NULL,1
    070A0205-56D6-FF84-688A-8A216A47A949,Customer - Fileservers Dienst,Customer.Fileservers.Dienst,7DDF2381-3B13-4971-9E91-6656075C2E60,2010-12-22 09:26:50.683,NULL,1
    98701ABB-AF93-7E5A-D121-9A18E0037CE8,Customer - DSA & PKI Gateways,Customer.DSA.PKI.Gateways,95B49F67-9514-4E80-991D-B3CF4EA2632F,2010-12-20 11:38:44.697,NULL,1
    FA4FDEAF-E107-8AA3-BD2C-9E29C58C0C53,Customer - PKI Management,Customer.PKI.Management,6B677888-07F1-4725-BA3F-E742B20FA9C4,2011-01-27 08:45:23.153,NULL,1
    51DA566A-1AC1-5DC9-3F66-A11FC439357C,nworks VMware Virtual Enterprise Monitoring MP,nworks.VMware.VEM,599A587E-3357-A127-50EF-198F04365ADA,2010-11-23 11:10:29.243,65c40f14a98ce59b,1
    512DB9E6-D21A-2E4F-E987-A28BDE8F940B,Customer - Exchange availability,Customer.Exchange.availability,1D0DDA6B-9ED2-48C0-BFEE-1538DA9AE16F,2010-12-27 10:10:30.707,NULL,1
    DD81FA7E-73BF-332B-C4B6-A767BB514BE8,Customer - Connect Direct,Customer.Connect.Direct,9C6BB3FD-6582-4F18-B18C-7BBE4DB9FCA6,2011-01-31 13:47:15.613,NULL,1
    155A8BBB-C6D2-C706-DD1C-B7EFCCCC0E81,Customer - AD Beheer,Customer.AD.Beheer,CF036BAA-47C0-4D09-A2F4-25B3DC1F78B9,2011-01-05 13:17:15.520,NULL,1
    E2296ED5-DDBC-EBC7-3881-C5288ADAA7CF,Microsoft Exchange Server 2010 Management Pack,Microsoft.Exchange.2010,AB06EB14-EAF1-0F0B-04B8-F1CDD33F4ACC,2011-02-04 09:02:29.607,31bf3856ad364e35,1
    9E138797-AE1C-AF6E-E61B-D110253B417C,Engyro Connector TEC,Engyro.Connector.TEC.MP,76306617-5F13-42EB-9F3B-B948F18DC4D8,2010-11-23 11:29:55.980,NULL,1
    A3C3E706-795F-BF80-DFC2-DBB4BDDFA919,Customer - ACS Management Pack,Customer.ACS.Management.Pack,D7C4F7A2-B18D-454F-8615-22CEC4EFDFCA,2011-01-04 12:30:01.593,NULL,1
    7C2A6181-B7B9-89C2-6FC3-EDB760FCEFC1,Microsoft Exchange Server 2007 CAS Monitoring - Override,Microsoft.Exchange.Server.CAS.Monitoring.Override,BA79A086-E992-4AB7-B4B6-933FB8AD1211,2011-01-07 12:39:36.870,NULL,1
    94DDD8EA-2A12-9E54-9545-F4A926DBACF0,System Center Core Monitoring Overrides,System.Center.Core.Monitoring.Overrides,BA527C6E-0E2C-440C-9358-6D073BBD4722,2010-12-07 07:25:25.517,NULL,1

     

    Now we can compare both files with the use of the compare-object cmdlet in PowerShell.

    $file1 = import-csv -Path "C:\temp\Test1.csv"
    $file2 = import-csv -Path "C:\temp\Test2.csv"
    Compare-Object $file1 $file2 -property MPFriendlyName -IncludeEqual

     

    image

    Have fun with PowerShell and the compare-object cmdlet.

     

    (stefan.stranger).gettype()

    IsPublic IsSerial Name BaseType

    -------- -------- ---- --------

    True False Object[] Crappy.Planner

  • Microsoft Codename Atlanta

    Source: http://beta.microsoftatlanta.com

     

    What is Microsoft Codename Atlanta?

    Microsoft Codename Atlanta (http://beta.microsoftatlanta.com) is an online service that analyzes installations of Microsoft SQL Server 2008 (and later versions) and provides proactive alerts to help you avoid system downtime and follow best practices with regard to configuration and usage. Atlanta is developed by the Microsoft Atlanta product group in partnership with Microsoft Support engineers to ensure that the issues customers report to Microsoft are detected before they affect your environment. Atlanta is regularly updated to reflect the most recent experiences of these engineers, who support SQL Server customers around the world.

    The Atlanta environment

    The Atlanta environment is made up of the Atlanta web service, hosted in the cloud, and the on-premise software, installed in your local environment. The on-premise software consists of one gateway and at least one agent. The agent collects data from your server and analyzes it using a set of rules (similar to a management pack in System Center Operations Manager) known collectively as Atlanta knowledge. The analyzed data is regularly sent from the agent to the gateway for upload to the Atlanta web service. If the data indicates an issue or a deviation from best practices, an alert is generated. By connecting a web browser to the Atlanta portal, you can view the alerts and the associated remediation guidance.

    Atlanta

     

    Agent

    The Atlanta agent is a software component that you install on each server being monitored by Atlanta and relies on Atlanta Management Packs (MPs). These MPs define the types of data the agent monitors and collects. The monitored data is collected periodically (daily by default) and sent to the gateway for subsequent transport to the cloud. The agent obtains its desired set of MPs from the gateway.

    Gateway

    The gateway is another software component that you install and acts as a proxy between the agents and Atlanta and is responsible for communication with the Atlanta service from your monitored servers. It aggregates data collected from one or more agents, uploads the collected data packages to Atlanta, and downloads the desired configuration and required MPs from the cloud for each of its agents and makes it available for those agents to consume.

    Screenshot of the MPs on the Gateway server

    image

    If you open the Atlanta SQL 2008 Discovery MP with the OpsMgr SQL 2008 Discovery MP you see that the are completely the same. (left Atlanta and right OpsMgr)

    image

    Co-existence with Operations Manager 2007 R2


    Atlanta uses the System Center Health Service to collect and analyze data. The version that is used by Atlanta is the same as the System Center Operations Manager 2007 R2 agent. Because of this, when you view the programs installed on your server, you will see System Center Operations Manager 2007 R2 agent software, particularly in Add/Remove Programs. Do not remove these as Atlanta is dependent on them. If you remove the Operations Manager agent software, Atlanta will no longer function.

    When you install an Atlanta agent on a computer that has a System Center Operations Manager 2007 R2 agent installed, the Health Service will be configured to run in multi-homing mode so that existing Operations Manager management groups are not impacted. For more information on multi-homing configurations, see Configure an Agent to Report to Multiple Management Groups, available in the System Ceenter Operations Manager 2007 R2 library, at http://go.microsoft.com/fwlink/?LinkID=204945.

    When you uninstall Atlanta, be sure to use the Uninstall.exe program located in the directory where you installed Atlanta (and not Add/Remove Programs). The uninstall program will uninstall Atlanta and update the System Center Operations Manager agent to remove Atlanta-specific configurations while ensuring that the Operations Manager agent continues to work. On computers with only Atlanta installed (and no Operations Manager), the agent is completely uninstalled.

    Atlanta is only supported with the System Center Operations Manager 2007 R2 agent and not with previous versions of System Center Operations Manager.

     

    Screenshots of installation of Agent and Gateway on the same server.

    First you need create an Account for Atlanta.

    image

    Follow the next steps to deploy the Atlanta Agent and Gateway

    image

     

    Run AtlantaSetup.exe

    image

    Choose installation option. (I choose to install the agent and gateway on the same server)

    Browse to downloaded Registration certificate.

    image

    image

     

    Open de Altanta Dashboard and check if your server is added.

    image

    image

     

    Links:

    Help on Atlanta: http://onlinehelp.microsoft.com/en-us/atlanta/default.aspx

  • My Operations Manager 2007 SQL Queries

    Jonathan Almquist started a blog post about Operations Manager 2007 SQL Queries.

    “I’m starting a new post here, similar to my Command Shell reference.  This will include some useful SQL queries that I happen to need and direct my customers to on a daily basis.  If you don’t see something here, check Kevin Holman’s blog.  He’s already got a library of useful queries posted, in which I will not duplicate here.

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

    I also have some SQL queries I used at customers I want to share. Would be nice if we had some kind of Wiki where we could post all our OpsMgr SQL queries though ;-)

    OperationsManager OperationsManagerDW
      Logical Free Megabytes on Windows Server 2000 and higher
     

    % Logical Disk Free Space on Windows Server 2003

    List all Windows Computers  

    Total Number of Servers per OS

     
  • Everything you wanted to know about OpsMgr Data Warehouse Grooming but were afraid to ask

    I know there are already quite some other blog posts about OpsMgr Data Warehouse Grooming.  But I was helping a customer with grooming their OpsMgr Data Warehouse Database (OperationsManagerdw) and got some questions. And you may have the same questions but you are afraid to ask ;-)

    1. How can I change the Grooming settings for the OpsMgr Data Warehouse?
      This cannot be done from within the OpsMgr Console.
      So what are the options then?
      1. DWdatarp tool

        Use the Data Warehouse Data Retention Policy (dwdatarp.exe) tool from the MOM team weblog.

        Tip: if after running the tool you don’t see any results, you may not be dbowner on the OperationsManagerDW database.

        image 

        You can save the results to a csv, but you need to do some manual stuff in Excel to have a nice formatted overview.
         image

        Read the help (dwdatarp /?) for all the options. You can also change the Grooming settings for the OpsMgr Data Warehouse with this tool.
      2. SQL queries
        You have to use some SQL queries and run those on the operationsmanagerdw database in SQL Server Management Studio.
        image 

        To view the Current OpsMgr Data Warehouse queries I use the next SQL queries from several sources.

        --Current Grooming Settings
        USE OperationsManagerDW
        SELECT AggregationIntervalDurationMinutes, BuildAggregationStoredProcedureName, GroomStoredProcedureName, MaxDataAgeDays, GroomingIntervalMinutes, MaxRowsToGroom FROM StandardDatasetAggregation

        --Last Grooming Time
        USE OperationsManagerDW
        select
        min(datetime) as MinDate,
        max(datetime) as MaxDate,
        datediff(d,min(datetime),max(datetime)) AS NoOfDaysInDataSet
        from Perf.vPerfHourly

        --To view the number of days of total data of each type in the DW:
        USE OperationsManagerDW
        SELECT DATEDIFF(d, MIN(DWCreatedDateTime), GETDATE()) AS [Current Alert] FROM Alert.vAlert
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Event] FROM Event.vEvent
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Perf Raw] FROM Perf.vPerfRaw
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Perf Hourly] FROM Perf.vPerfHourly
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Perf Daily] FROM Perf.vPerfDaily
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current State Raw] FROM State.vStateRaw
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current State Hourly] FROM State.vStateHourly
        SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current State Daily] FROM State.vStateDaily

        --To view the oldest and newest recorded timestamps of each data type in the DW:
        USE OperationsManagerDW
        select min(DateTime) AS [Oldest Event Date] from Event.vEvent
        select max(DateTime) AS [Newest Event Date] from Event.vEvent
        select min(DateTime) AS [Oldest Perf Date]from Perf.vPerfRaw
        select max(DateTime) AS [Newest Perf Date]from Perf.vPerfRaw
        select min(DWCreatedDateTime) AS [Oldest Alert Date] from Alert.vAlert
        select max(DWCreatedDateTime) AS [Newest Alert Date] from Alert.vAlert

        --Which Tables used the most space
        USE OperationsManagerDW
        SELECT so.name,
        8 * Sum(CASE WHEN si.indid IN (0, 1) THEN si.reserved END) AS data_kb,
        Coalesce(8 * Sum(CASE WHEN si.indid NOT IN (0, 1, 255) THEN si.reserved END), 0) AS index_kb,
        Coalesce(8 * Sum(CASE WHEN si.indid IN (255) THEN si.reserved END), 0) AS blob_kb
        FROM dbo.sysobjects AS so JOIN dbo.sysindexes AS si ON (si.id = so.id)
        WHERE 'U' = so.type GROUP BY so.name  ORDER BY data_kb DESC


        If you look at results of the first two queries (current grooming settings and last grooming time)
         image
        Another interesting query is the “Which Tables used the most space” query. You can run this query before and after changing the grooming settings to see if the grooming had any effect.
        If you want to change the Grooming settings you can use the next queries.
        N.B. Change to the values you want to have your Grooming settings configured!!

        -- From http://ops-mgr.spaces.live.com/blog/cns!3D3B8489FCAA9B51!176.entry
        -- Alert Data:

        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 100
        WHERE GroomStoredProcedureName = 'AlertGroom'

        --Event Data:
        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 40
        WHERE GroomStoredProcedureName = 'EventGroom'

        --Performance Data:
        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 100
        WHERE GroomStoredProcedureName = 'PerformanceGroom' AND AggregationIntervalDurationMinutes = '60'

        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 200
        WHERE GroomStoredProcedureName = 'PerformanceGroom' AND AggregationIntervalDurationMinutes = '1440'

        --State Data:
        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 40
        WHERE GroomStoredProcedureName = 'StateGroom' AND MaxDataAgeDays = 180

        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 100
        WHERE GroomStoredProcedureName = 'StateGroom' AND AggregationIntervalDurationMinutes = '60'

        USE OperationsManagerDW
        UPDATE StandardDatasetAggregation
        SET MaxDataAgeDays = 200
        WHERE GroomStoredProcedureName = 'StateGroom' AND AggregationIntervalDurationMinutes = '1440'

    2. How can I see if Grooming has worked?
      You can check if Grooming has worked after changing the Grooming settings by looking at the dwdatarp tool results or by running some SQL queries.

      Tip: save the results from the dwdatarp tool or SQL queries before and after changing the grooming settings to compare them.

      If you have used the dwdatarp tool for saving the before and after grooming results you can have a look at the columns Current Size and Current Row Count if they changed after changing the grooming settings. 
      image   

      If you like to use SQL you can run the “Which Tables used the most space” sql query to look if those have changed after changing the grooming settings.

      It’s also important to look at the current size and free space of the operationsmanagerdw before starting to groom.

      image
    3. Why don’t my database files shrink after grooming?
      That’s another question people often ask, and that is because the SQL DB files are static – they are manually sized. You can check your autogrow settings for the OperationsManagerDW with the Microsoft SQL Server Management Studio. For the OperationsManager Database Autogrow is default disabled and for the OperationsManagerDW the default setting for Autogrow is enabled.
      image
      If you look at the Autoshrink setting for the OperationsManagerDW you can see it’s disabled.
      image
      That’s why the database files won’t shrink after grooming has taken place. Please keep in mind that we don’t support/recommend EVER shrinking a DB file for OpsMgr. It causes fragmentation issues.

      The only thing that will change (shrink) after grooming is the used space in the database. You can check the used space for a database with the Disk Usage Report in Microsoft SQL Server Management Studio.
      image

      image

      But, sometimes shrinking the database is the only option left if you don’t have any space left…

    Disclaimer

    Please be very careful when changing your grooming settings, you can loose data ;-) Posts in this blog are provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified in the Terms of Use

    Links to other blog posts about Grooming:

  • OpsMgr Video Experiment: Ask About OpsMgr question

    Source: Pavleck.Net

    Jeremy started an OpsMgr Video Experiment called Ask About OpsMgr and I really like the idea.

    “I’ve been reading and hearing all over the place how complicated and difficult Operations Manager is. You’re half-right. It’s immensely complicated when compared to previous editions, and when it’s your first exposure to it. I’m aiming to change all that, and I’m trying it in a new medium - video! So watch the video below (Or if your firewall rules don’t prohibit it, go directly to the YouTube link) and post a video response asking me your question. Any question.

    I’ll do my best to answer it with the help of the OpsMgr Army and screencast it all!”

    So because I quite new to creating videos I installed my webcam software did some tests and create my first Ask About OpsMgr Video question! Sorry for not being a great actor yet:-)

    I’ve already some thoughts about how I would solve my question but maybe there are some other ways to do it.

    Merry Xmass and Happy New Year!

  • Passed my MOFv4 (Microsoft Operations Framework) exam

    Today I took my MOFv4 exam and passed with a score of 90%. I made 4 mistakes from the 40 questions. Not bad I believe ;-)

    If I’ve some time in the future I want to blog some stuff on how to use MOF with OpsMgr 2007. But I don’t think that’s soon because I’m quite busy at the moment.

    Looking for more info? Go to http://www.microsoft.com/mof

  • Lessons learned - The OpsMgr 2007 R2 Universal Connector

    Last week I was asked to help a customer with the configuration of an OpsMgr 2007 R2 connector. Because I had not much hands on experience with the installation and configuration of the OpsMgr 2007 R2 Connectors I installed an configured the Universal Connector in my own test/demo environment.

    And because I learned some new things during this exercise I thought it would be a good idea to share some of my experiences. Warning, this turned out to be become a long blogpost. Stop reading here if you can only read short (twitter) messages Winking smile

    Environment:

    • OpsMgr 2007 R2 CU3
    • OpsMgr 2007 R2 RMS server running on Windows 2008 R2
    • All-In-One RMS with SQL 2008 R2
    • SUSE Linux Enterprise Server (Linux suse10 2.6.16.46-0.12-default)

     

    Downloads:

    I started downloading the free connectors from Microsoft Downloads. This release of the Operations Manager 2007 R2 Connectors includes the following Connectors:

    • Microsoft System Center Operations Manager 2007 R2 Connector for IBM Tivoli Enterprise Console
    • Microsoft System Center Operations Manager 2007 R2 Connector for HP OpenView Operations for Unix
    • Microsoft System Center Operations Manager 2007 R2 Connector for HP OpenView Operations for Windows
    • Microsoft System Center Operations Manager 2007 R2 Connector for BMC Remedy ARS
    • Microsoft System Center Operations Manager 2007 R2 Universal Connector

     

    Documentation:

    If you extract the downloaded SCInterop_R2_RTM.zip file there is a Docs folder with 4 files of documentation you should be READING before installing the Connectors.

    • OM2007_Connectors.doc
    • OM2007_ConnectorsRn.htm
    • OM2007_MP_Connector.doc
    • SCOM2007R2_UniversalConnector_DevelopingAnIntegration.doc

     

    Tools:

    I used the following tools to install and configure the Universal Provider on my SLES10 system:

    • Putty (PuTTY is an SSH and telnet client)
    • WinSCP (WinSCP is an open source free SFTP client, SCP client, FTPS client and FTP client for Windows)
      I used this tool to copy the scx-<build-number>.sles.10.x86.rpm (Interop Core package) installation files from my Windows machine to the SLES10 machine.

     

    You should start reading the Release Notes (OM2007_ConnectorsRn.htm)  thoroughly before you install or upgrade any Operations Manager 2007 R2 Connectors. The next step is reading the Operations Manager 2007 R2 Connectors Deployment Guide (OM2007_Connectors.doc). Here you can check the System Requirements.  In my test/demo environment I’ve installed the Connector Service and Configuration UI on a Windows Server 2008 R2 system without any issues. But be aware this is not supported (yet).

    Other documentation I used to get ready for the installation is this blogpost from our famous Kevin Holman Installing the OpsMgr R2 Universal Connector.

    Operations Manager 2007 Connectors Architecture:

    UniversalConnector

     

    High-Level Installation Steps:

    1. Check Pre-requisites on both systems.
    2. Install Universal Provider on SUSE10 server (always first start with the Provider)
    3. Install Universal Connector Service and Configuration on Windows Server 2008 R2 Server
    4. Configure the Universal Connector

     

    For the detailed installation steps see the Operations Manager 2007 R2 Connectors Deployment Guide but I’ll show some tips and tricks I used to get the Universal Connector installed and configured.

     

    Tips & Tricks:

    Step 1. Check Pre-requisites on both systems.

    How do you check if WSMan is installed on a Windows system?

    You can check if WSMan is installed using the next command from the command prompt:

    winrm identify

    image

    So on my Windows 2008 R2 RMS (where I’ll be installing the Universal Connector Service and UI) WSMan is running.

    How can check if WSMan is running on the remote SLES10 machine?

    Keep in mind that during the install of the SCX agent (Interop core) first  the wsman components (Open Pegasus) will be installed and later the Univeral provider will be installed on top of the SCX agent.

    So it would be “normal” not having wsman installed on the remote SLES10 machine. But in case you want to check anyway. You could check for the cimserver process on the SLES10 machine using the next command in Putty:

    ps –eaf | grep cimserver

    image

    The winrm also has a remote parameter. winrm id –remote:nameofremoteserver.com

    Let’s try to run this from the RMS server.

    image

    It seems we don’t have the correct permissions to do this. Let’s try to use the winrm’s INVOKE verb. More info on the use of the INVOKE verb can be found at Daniele Muscetta’s blogpost about winrm and invoke.

    Run the following command from a Windows machine:

    winrm invoke ExecuteCommand http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx @{command="ps -eaf";timeout="60"} -username:root -password:Password -auth:basic -r:https://suse10:1270/wsman -skipCACheck -encoding:UTF-8

    image

    There we have it, all running processes on the SLES10 machine using WSMan. Keep in mind this test was run AFTER I had installed the Interop core which also installs Open Pegasus.

     

    Do I need to install the 32-bit version of the Microsoft Visual C++ 2008 Redistributable Package (x86) on a 64-bit Windows 2008 R2 server?

    Yes you need to install the x86 version on a 64-bit OS.

     

    Step 2. Install Universal Provider on SUSE10 server (always first start with the Provider)

    How do I copy the Universal Provider files to my SLES10 server?

    Use WinSCP to connect from your Windows server, where you have the installation files for the connectors to the SLES10 server. Copy the correct OS version files (in my case I copied the files from the Linux_SUSE_10.0_x86_32 folder) to a location (/tmp) on the remote SLES10 server.

    clip_image002

     

    How do I install the Universal Provider on my SLES10 server?

    Use Putty to make a connection to the remote SLES10 machine. Logon with an account which has enough privileges to install the software (I used the root account for the installation of the Universal Provider).

    The first part of the installation is the installation of the the SCX agent first (Interop core) the wsman components (Open Pegasus)

    run the following command in your Putty session: rpm –i /tmp/Linux_SUSE_10.0_x86_32/scx-1.0.4-248.sles.10.x86.rpm

    image

    The second part of the installation is the installation of the Universal Provider.

    Run the next command in your Putty session: Rpm -i MSFTscinteropUnv-6.17000-58.suse.10.x86.rpm

    image

    You can check the result of the installation in the /tmp/scinterop_install.out file using cat or WinSCP if you want.

     

    Step 3. Install Universal Connector Service and Configuration on Windows Server 2008 R2 Server

    Install the Universal Connector and UI using an elevated command prompt.

    Which Features do I need to select during the installation of the Universal Connector and UI?

    Select Entire feature will be installed on local harddrive.

    image

    Remark: You can change the location where the Universal Connector Service is installed if you want.

     

    Which account be used for the Connector Service?

    • On the Connector Service Login page, type in the credentials for the connector service. The connector service will be configured to run under these credentials. This will be used to connect to the SDK on the RMS, and will be used to authenticate to the provider via WSMAN. I used my SDK service account for this, since it already has access to the OpsMgr SDK. Added this account to the local admins group on Server running the Connector Service during the prerequisites stage.
    • Remark: OM_SDK account needs to be member of the Operations Manager Administrators Role.

     

    After the installation of the Universal Connector Service a new database SCInterop is created.

    One step in the configuration is granting the Connector Service Account (SDK account) enough permissions for the SCInterop database. The SDK Config account need db_owner permissions.

    image

    Now it’s time to configure the Universal Connector.

    image

    image

    Which User name do I use for the WS-Man server credentials?

    Enter the next settings:

    • Operations Manager Server (RMS name to connect to the SDK)
    • Universal Provider (Provider server NetBIOS name – NOT FQDN)
    • WS-Man Server credentials (this is an account that has rights to the provider server via WSMan)

     

    image

    Instead of using the root account on the SLES10 server where I installed the Universal Provider I created a scxuser account.

    The scxuser is member of the following groups on the SLES10 server:

    image

    The next step in the Configuration is testing the connection.

    image

    The first time I tested the connection I got an error message.

    image

    Before clicking on Yes to continue the configuration I opened a command prompt to test the connection using the scxuser account.

    Run the following command from the command prompt:
    winrm enumerate http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx -username:scxuser -password:Password -r:https://suse10:1270/wsman -auth:basic -skipCACheck -encoding:UTF-8

    image

    There seems something wrong with the SSL certificate.

    The Connector requires the use of certificates to validate the authenticity of the server on which the Interop Provider is running. The Connector does not work until the certificate has been transferred and correctly imported to the server on which Connector is running (Windows 2008 R2 RMS Server) from the server on which the Interop Provider (SLES10 Server) is running. During the Interop Provider installation, a self-signed certificate is generated and stored in the Interop Provider installation directory. The Connector Certificate Retrieval and Installation wizard retrieves the certificate and automatically installs it on the server on which the Connector is running. Installing the Connector certificate at installation is optional. However, the Connector certificate must be installed on the server on which the Connector is running before the Connector service is started. If you do not install the Interop Provider certificate, the Connector cannot communicate with the server on which the Interop Provider is running.

    Fixed it by following the next steps:

    1. Copied the scx-host-suse10.pem file to the RMS server

    clip_image001

    2. Runned scxcertconfig -sign scx-host-suse10.pem scx_new.pem on RMS

    clip_image002

    3. Copied the scx_new.pem file to the SUSE10 box (Provider) and renamed it to scx-host-suse10.pem

    clip_image003

    4. Restarted scxadmin –restart (on the SLES10 server)

    image

    5. Tested WSMan connection to provider from RMS.

    In the Universal Connector folder there is a tool called scicert.exe which can be used to test the connection.

    image

    Run the following command from the command prompt:

    scicert suse10 scxuser Password "OpsMgr Universal Connector" test

    image

    Seems to be working ok, right now Smile

    You can also use the winrm enumerate command if you want to:

    winrm enumerate http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx -username:scxuser -password:Password -r:https://suse10:1270/wsman -auth:basic -skipCACheck -encoding:UTF-8

    image

     

    We now have the Universal Connector installed and configured, now we need to test if OpsMgr Alerts will be forwarded from OpsMgr to the Universal Provider on the SLES10 server.

     

    High-Level Steps to test the Universal Connector.

    1. Add to add a new subscriptions for alerts that you want to send to the connector.
    2. Create a test event rule
    3. Manually emulate an EMS (Enterprise Management System)

     

    Step 1. Add  a new subscription for alerts that you want to send to the connector.

    Go to Administration Pane and select Internal Connectors folder. Select the OpsMgr Universal Connector.

    image

    Double click on the OpsMgr Universal Connector. In the properties of the OpsMgr Universal Connector enter a Subscription Name and optionally a Description.

    image

    Click Next and configure the Groups criteria

    image

    Click Next and configure the Targets.

    image

    Click Next and configure the Alert Criteria

    image

    And in the last screen click OK to save your Subscription.

    image

     

    Step 2. Create a Test Event Rule.

    Just follow the normal steps to create an Event Alert Rule which get’s triggered by eventid 999.

    image

    image

    Every time an event 999 is created an Alert is generated.

    Just use the EventCreate.exe tool to create an Event 999 from the command prompt:

    eventcreate.exe /T ERROR /ID 999 /L APPLICATION /D "Testing Universal Connector"

    Result:

    image

     

    Before we look at what happens on the Remote Universal Provider we need to have some background info on the New Alert Data workflow.

     

    New Alert Data Flow in the Universal Connector:

    1. The Operations Manager alert is forwarded to remote system in either XML or Key=Value Pair(evt) file format (I configured to use XML)
    2. The universal provider on the remote system creates a file (xml or property file) in a specified directory
    3. The custom integration logic picks up file from specified directory and inserts data into the remote system application
    4. The custom integration logic creates a file in a specified directory with specific data to update the Operations Manager alert, i.e. TicketID
    5. The universal provider picks up custom integration file and sends it back to Operations Manager to update the alert
    6. The Operations Manager alert is updated

     

    Step 1 and 2. The Operations Manager alert is forwarded to remote system in either XML or Key=Value Pair(evt) file format and The universal provider on the remote system creates a file (xml or property file) in a specified directory

    We can check if the OpsMgr Alert is forwarded to the remote Universal Provider, which I configured to be in XML format, by opening WinSCP and look in the following folder: /opt/microsoft/scx/UnvEvents/FromOpsMgr

    image

    Let’s create a new Alert by creating a new 999 EventID and check if there will created an XML file in the /opt/microsoft/scx/UnvEvents/FromOpsMgr folder

    image

    image

    Now look at the remote folder and check if we see the xml file on the Universal Provider.

    image

    Let’s check the contents of the xml file.

     

    <?xml version="1.0" encoding="utf-8"?>
    <UNVEvent>
    <AlertId>c16964d1-b01d-4e44-99c9-d892d28fe680</AlertId>
    <ComputerDomain>DEMO</ComputerDomain>
    <ComputerName>OPSMGRR2RMS</ComputerName>
    <Description>Event Description: Testing Universal Connector</Description>
    <EventType>0</EventType>
    <ManagementGroupName>DEMOMG</ManagementGroupName>
    <ManagementPack>Stefan.Test.Universal.Connector</ManagementPack>
    <ManagementServer>opsmgrr2rms</ManagementServer>
    <ModifiedBy>DEMO\OM_Admin</ModifiedBy>
    <MonitoringClassName>Microsoft.Windows.Computer</MonitoringClassName>
    <MonitoringObjectHealthState>Success</MonitoringObjectHealthState>
    <MonitoringObjectInMaintenanceMode>False</MonitoringObjectInMaintenanceMode>
    <MonitoringObjectName>OPSMGRR2RMS.DEMO.STRANGER</MonitoringObjectName>
    <Name>Stefan - Test Universal Connector Event Rule</Name>
    <Priority>Normal</Priority>
    <ProblemId>afcc789a-d227-37a2-79ff-70c6cf469eba</ProblemId>
    <RepeatCount>0</RepeatCount>
    <ResolutionState>255</ResolutionState>
    <RuleName>MomUIGeneratedRule75cfefecc3264771af35f117e44a64ff</RuleName>
    <RuleTarget>Microsoft.Windows.Computer</RuleTarget>
    <Severity>2</Severity>
    <TimeOfLastEvent>2011-08-15T16:48:43.557Z</TimeOfLastEvent>
    <WebConsoleUrl>http://OPSMGRR2RMS:51908/default.aspx?DisplayMode=Pivot&amp;AlertID=c16964d1-b01d-4e44-99c9-d892d28fe680</WebConsoleUrl>
    </UNVEvent>

    Let’s also check if something has changed on the OpsMgr side.

    image

    We don’t see a new Ticked ID or Owner change. The only indication we see is that the History has some info.

    image

     

    Step 3. The custom integration logic picks up file from specified directory and inserts data into the remote system application.

    Now the Universal EMS should pick up the xml file from the /opt/microsoft/scx/UnvEvents/FromOpsMgr and change this data in the EMS (Enterprise Management System). We can do the same manually if we want to test this.

    Steps:

    1. Create a new directory called "<Provider Install Directory>\UnvEvents\<MgmtGrpName>\ using WinSCP on the SLES10 server.

    clip_image001[4]

    clip_image002[4]

    clip_image003[4]

    2. Create a directory called "<Provider Install Directory>\UnvEvents\<MgmtGrpName>\EMS". This directory will contain a evt/xml file with all the necessary information about the alert that is in sync with the connector. If you close the alert in OpsMgr this file will be deleted, acknowledging that the alert was closed.

    clip_image004[4]

    3. You can manipulate the evt/xml file in the EMS directory then drop it into the "<Provider Install Directory>\UnvEvents\<MgmtGrpName>" directory to send updates back to the OpsMgr alert.

    To send an update back to OpsMgr the EventType variable must always be set to 1 (e.g.; EventType=1 or <EventType>1</EventType>).

    Fields that can be update on the OpsMgr alert from the EMS side:

    • EventType
    • OwnerName
    • CustomField1 thru CustomField10
    • ResolutionState


    Let's update the Alert:

    Copy file c16964d1-b01d-4e44-99c9-d892d28fe680.1.xml from /opt/microsoft/scx/UnvEvents/FromOpsMgr to /opt/microsoft/scx/UnvEvents/DEMOMG/EMS folder

     

    cp /opt/microsoft/scx/UnvEvents/FromOpsMgr/c16964d1-b01d-4e44-99c9-d892d28fe680.1.xml /opt/microsoft/scx/UnvEvents/DEMOMG/EMS

    image

     

    Edit c16964d1-b01d-4e44-99c9-d892d28fe680.1.xml

    <?xml version="1.0" encoding="utf-8"?>
    <UNVEvent>
    <AlertId>c16964d1-b01d-4e44-99c9-d892d28fe680</AlertId>
    <ComputerDomain>DEMO</ComputerDomain>
    <ComputerName>OPSMGRR2RMS</ComputerName>
    <Description>Event Description: Testing Universal Connector</Description>
    <EventType>0</EventType>
    <ManagementGroupName>DEMOMG</ManagementGroupName>
    <ManagementPack>Stefan.Test.Universal.Connector</ManagementPack>
    <ManagementServer>opsmgrr2rms</ManagementServer>
    <ModifiedBy>DEMO\OM_Admin</ModifiedBy>
    <MonitoringClassName>Microsoft.Windows.Computer</MonitoringClassName>
    <MonitoringObjectHealthState>Success</MonitoringObjectHealthState>
    <MonitoringObjectInMaintenanceMode>False</MonitoringObjectInMaintenanceMode>
    <MonitoringObjectName>OPSMGRR2RMS.DEMO.STRANGER</MonitoringObjectName>
    <Name>Stefan - Test Universal Connector Event Rule</Name>
    <Priority>Normal</Priority>
    <ProblemId>afcc789a-d227-37a2-79ff-70c6cf469eba</ProblemId>
    <RepeatCount>0</RepeatCount>
    <ResolutionState>0</ResolutionState>
    <RuleName>MomUIGeneratedRule75cfefecc3264771af35f117e44a64ff</RuleName>
    <RuleTarget>Microsoft.Windows.Computer</RuleTarget>
    <Severity>2</Severity>
    <TimeOfLastEvent>2011-08-15T16:48:43.557Z</TimeOfLastEvent>
    <WebConsoleUrl>http://OPSMGRR2RMS:51908/default.aspx?DisplayMode=Pivot&amp;AlertID=c16964d1-b01d-4e44-99c9-d892d28fe680</WebConsoleUrl>
    </UNVEvent>

    <?xml version="1.0" encoding="utf-8"?>
    <UNVEvent>
    <AlertId>c16964d1-b01d-4e44-99c9-d892d28fe680</AlertId>
    <ComputerDomain>DEMO</ComputerDomain>
    <ComputerName>OPSMGRR2RMS</ComputerName>
    <Description>Event Description: Testing Universal Connector</Description>
    <EventType>1</EventType>
    <ManagementGroupName>DEMOMG</ManagementGroupName>
    <ManagementPack>Stefan.Test.Universal.Connector</ManagementPack>
    <ManagementServer>opsmgrr2rms</ManagementServer>
    <ModifiedBy>DEMO\OM_Admin</ModifiedBy>
    <MonitoringClassName>Microsoft.Windows.Computer</MonitoringClassName>
    <MonitoringObjectHealthState>Success</MonitoringObjectHealthState>
    <MonitoringObjectInMaintenanceMode>False</MonitoringObjectInMaintenanceMode>
    <MonitoringObjectName>OPSMGRR2RMS.DEMO.STRANGER</MonitoringObjectName>
    <Name>Stefan - Test Universal Connector Event Rule</Name>
    <Priority>Normal</Priority>
    <ProblemId>afcc789a-d227-37a2-79ff-70c6cf469eba</ProblemId>
    <RepeatCount>0</RepeatCount>
    <ResolutionState>255</ResolutionState>
    <RuleName>MomUIGeneratedRule75cfefecc3264771af35f117e44a64ff</RuleName>
    <RuleTarget>Microsoft.Windows.Computer</RuleTarget>
    <Severity>2</Severity>
    <TimeOfLastEvent>2011-08-16T10:44:19.830Z</TimeOfLastEvent>
    <WebConsoleUrl>http://OPSMGRR2RMS:51908/default.aspx?DisplayMode=Pivot&amp;AlertID=1fbc6201-773f-4680-a120-e6e7e684cd8e</WebConsoleUrl>
    <OwnerName>EMS</OwnerName>
    <CustomField1>Manual Test of EMS</CustomField1>
    </UNVEvent>

    Drop it into the "/opt/microsoft/scx/UnvEvents/DEMOMG

    cp /opt/microsoft/scx/UnvEvents/DEMOMG/EMS/c16964d1-b01d-4e44-99c9-d892d28fe680.1.xml /opt/microsoft/scx/UnvEvents/DEMOMG

     

    image

    Is gone in seconds

    clip_image014

    imageimage

    Works ok :-)

     

    I also created a PowerShell script which retrieves the remote xml file so you can check what has been forwarded from the Universal Connector to the Remote Universal Provider. But I need some more time to improve this script.

    Here is a first example on how I started. If I’ve more time I’ll create a blogpost on how to create a PowerShell EMS tool.

    #use winrm with invoke to retrieve the last xml file from the remote Universal Provider
    [string]$AlertFromUnvConn =  cmd /c 'winrm invoke ExecuteShellCommand http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx @{command="ls -1t /opt/microsoft/scx/UnvEvents/FromOpsMgr/*.xml | head -1 | xargs cat";timeout="60"} -username:root -password:Password -auth:basic -r:https://suse10:1270/wsman -skipCACheck -encoding:UTF-8'
    $subject = $AlertFromUnvConn

    #Parse the result so we can use this fix the returned XML
    if ($subject -cmatch '(?si)<UNVEvent\b[^>]*>(.*?)</UNVEvent>') {
        $result = $matches[0]
    } else {
        $result = ''
    }

    #Convert result to genuine xml
    [xml]$xml = $result

    #Show Result
    $xml.UNVEvent | format-list

    Result:

    image

     

    Have fun!