• 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.

  • 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!

  • 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!

  • 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…

  • Evaluating System Center 2012 R2 Preview Operations Manager

    As you all probably have noticed we announced the Preview version of System Center 2012 R2 during at TechEd Europe 2013.  You can download the Evaluation VHD from here.

    Downloading the VHDs saves you quite some time evaluating these new OpsMgr bits. Some time ago I wrote a blogpost on how to install OpsMgr 2012 (SP1) the fast way using VHDs.

    Again you also need to install a Domain Controller, and this time we are going to use Windows Server 2012 R2 Datacenter Preview VHD (Server Core) to host the Domain Controller.

    But before we get started let’s give a short overview of the updated features.

    Fabric Monitoring

    By integrating System Center 2012 R2 Virtual Machine Manager and System Center 2012 R2 Operations Manager, System Center cloud hybrid monitoring of physical and virtual layers can be achieved. A new System Center 2012 Management Pack for System Center 2012 R2 Virtual Machine Manager Dashboard Preview is needed for this feature.

    This will give you a Fabric Health Dashboard with a detailed overview of the health of your private clouds and the fabric that services those clouds.

    Microsoft Monitoring Agent

    This is a new version of the Operations Manager Agent that includes full functionality of Visual Studio IntelliTrace Collector for gathering full application profiling traces.

    Integrating Operations Manager with Development Processes (DevOps)

    Here are two important changes to the DevOps functionality in System Center 2012 R2 Operations Manager:

    • New Alert Fields of Team Foundation Server (TFS) Work Item ID and TFS Work Item Owner
    • Conversion of Application Performance Monitoring (APM) Performance Events to IntelliTrace format

    Support for IPv6

    The Operations console can take IPv6 addresses as input for Network Discovery and display IPv6 addresses in the network-related views.

    Java Application Performance Monitoring

    The System Center 2012 Management Pack for Java Application Performance Monitoring lets you monitor Java application performance and exception events by using Operations Manager Application Advisor.

    And finally System Center Advisor

    System Center Advisor is an online service that analyzes installations of Microsoft server software. With the latest preview version of Advisor and Update Rollup 2 of System Center 2012 Service Pack 1 (SP1), you can now view Advisor alerts in the Operations Manager Operations console.

    For the complete detailed overview of what is new check the What's New in System Center 2012 R2 Operations Manager page on TechNet.

    Start downloading those evaluation vhds and I’ll explain in my next blogpost how to install System Center 2012 R2 Preview Operations Manager the fast way.

    Have fun downloading.

  • 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:

  • System Center 2012 R2 Visio Stencils

    Kevin Green published a great set of new System Center 2012 R2 Visio Stencils for all your System Center designs. Go grab them from Kevin’s Skydrive!

    Thank you Kevin for sharing those Visio Stencils!

  • PowerShell Sort-Object gotcha’s

    This week I’m again delivering a PowerShell workshop and during the use of the Sort-Object Cmdlet in the Pipeline we had a interesting discussion which I want to share with you.

    You all probably know you can use the Sort-Object Cmdlet in the Pipeline to sort your objects. Let’s start with a simple Ascending sort for the objects from the Get-Service cmdlet on the Service Name property.

    1 Get-Service | Sort-Object -Property Name | Format-Table Name, Status -AutoSize

    This gives us a nicely formatted overview from all Services sorted Ascending on Name:

    image

    We can also sort on Name Descending with the –Descending parameter Switch for the Sort-Object Cmdlet.

    1 Get-Service | Sort-Object -Property Name -Descending | Format-Table Name, Status -AutoSize

    image

    Simple right?

    But what if we want to do the following? We want to sort on Status Ascending. So we want to see first the Running Services before the Stopped Services. The “R” is before the “S” in the Alphabet. Right?

    1 Get-Service | Sort-Object -Property Status | Format-Table Name, Status -AutoSize

    image

    Strange? We expect to see the Running Services before the Stopped Services. Right? No not completely because when you sort in ascending order by status value, "Stopped" services appear before "Running" services.
    The Status property of a service is an enumerated value in which the names of the statuses represent integer values. The sort is based on the integer value, not the name. "Running" appears before "Stopped" because "Stopped" has a value of "1",
    and "Running" has a value of "4"

    And what if we want to sort on two properties but both have a different sorting order?

    Let’s sort our Services with the names in ascending order and status in descending order. Now we need to use hashtables.

    1 get-service | sort-object -property @{Expression="Status";Descending=$true}, @{Expression="Name";Descending=$false} | 2 format-table name, status –autosize

    image

    Again keep in mind that sorting on Status Descending is showing the Running (value=4) before the Stopped (value=1) services.

    Have fun!

  • Update: List of latest cumulative update releases for Operations Manager

     This article lists all latest cumulative updates that were released for Microsoft System Center Operations Manager. I created this overview to easily find the latest Update Rollups for all the different versions of Operations Manager.
    Hope you also like this overview.

    Cumulative Updates Overview Windows Agents

    OpsMgr Version

    Latest Cummulative Update with patches for OpsMgr

    KB Article link

    Download link

    Agent Build Version

    Remarks

    OM2007R2

    7

    http://support.microsoft.com/kb/2783850

    http://www.microsoft.com/en-us/download/details.aspx?id=36379

    6.1.7221.0

    List of all OpsMgr R2 Cumulative Updates:

    http://support.microsoft.com/kb/2453149

    OM2012RTM

    7

    http://support.microsoft.com/kb/2756127

    http://catalog.update.microsoft.com/v7/site/Search.aspx?q=2750631

    7.0.8560.0

    Update Rollup 7 for System Center 2012
    This update was released on October 22, 2013, but did not contain any updates for System Center 2012 Operations Manager. Because all System Center 2012 components are on the same release cycle, the update rollup (UR) number increases with each release regardless of whether the component has an update. The management pack for UNIX and Linux Operating Systems was upgraded to version 7.4.4337.0 and can be obtained here

    OM2012SP1

    4

    http://support.microsoft.com/kb/2879276

    http://catalog.update.microsoft.com/v7/site/Search.aspx?q=2880799

    7.0.9538.0

     

    Cumulative Updates Crossplatform Agents

    OpsMgr Version

    Latest Cummulative Update with patches for OpsMgr

    KB Article link

    Download link

    Agent Build Version

    Remarks

    OM2007R2

    7

    http://support.microsoft.com/kb/2783850

    http://www.microsoft.com/en-us/download/details.aspx?id=18891

    1.0.4-318

    List of all OpsMgr R2 Cumulative Updates:

    http://support.microsoft.com/kb/2453149

    OM2012RTM

    7

    http://support.microsoft.com/kb/2756127

    http://www.microsoft.com/en-us/download/details.aspx?id=29696 1.4.1-292

    Update Rollup 7 for System Center 2012
    This update was released on October 22, 2013, but did not contain any updates for System Center 2012 Operations Manager. Because all System Center 2012 components are on the same release cycle, the update rollup (UR) number increases with each release regardless of whether the component has an update. The management pack for UNIX and Linux Operating Systems was upgraded to version 7.4.4337.0 and can be obtained here

    OM2012SP1

    4

    http://support.microsoft.com/kb/2879276 http://www.microsoft.com/en-us/download/details.aspx?id=29696 1.4.1-292 Same download as UR5 for OM12RTM

    I tried to be as accurate as possible, but if I made a mistake please let me know using the comment section so I can fix the error.

    Update:

    * Since all System Center 2012 products are on the same release cycle the UR number increases with each release whether each product has a release or not.

    Latest available Update Rollup for System Center 2012 Products: 6
    This Update Rollup 6 was only for System Center Virtual Machine Manager 2012.
    Operations Manager did not have any patches for UR6 for server/console/agent/gateway. The only OpsMgr UR6 content are MPs and agents (MPBs) for UNIX/Linux.

    ** The updated agents/MPs for SP1 also work for 2012 (with the exception of Microsoft.Unix.Library)

    Disclamer: this posting is provided "AS IS" with no warranties, and confers no rights.

  • Free ebook: Introducing Microsoft System Center 2012 R2

    Yesterday we released a new free ebook called Introducing Microsoft System Center 2012 R2.

    image

    Microsoft System Center is one of the three pillars of Microsoft’s Cloud OS vision that will transform the traditional datacenter environment, help businesses  unlock insights in data stored anywhere, enable the development of
    a wide range of modern business applications, and empower IT to support  users who work anywhere while being able to manage any device in a secure and consistent way. The other two pillars of the Cloud OS are, of course, Windows
    Server 2012 R2 and Windows Azure, and Microsoft Press has recently released free Introducing books on these platforms as well.
    Whether you are new to System Center or are already using it in your  business, this book has something that should interest you. The capabilities of each component of System Center 2012 R2 are first described and then demonstrated
    chapter by chapter. Real-world and under-the-hood insights are also provided by insiders at Microsoft who live and breathe System Center, and those of you who are experienced with the platform will benefit from the wisdom and experience
    of these experts. We also included a list of additional resources at the end of each chapter where you can learn more about each System Center component.

    Go download the free ebook here

    Was it useful?
    Did it teach you what you wanted to learn?
    Was there room for improvement?
    Let us know at http://aka.ms/tellpress
    Your feedback goes directly to the staff at Microsoft Press,
    and we read every one of your responses. Thanks in advance!

    :

  • First look at Dell’s Mobile IT solution with Operations Manager Mobile Pack

    Today I listened to the 252st Episode of the  PowerScripting Podcast with Chris Ashley and Dmitry Petrashev from Dell on Mobile IT and PowerGui and wanted to test their Mobile IT Solution with System Center Operations Manager.

    According to their website Mobile IT makes it easy to provide secure, easy-to-use, mobile access to everyday applications that enhance the productivity of your mobile workforce.

    With the product’s unique mobile connector, you can quickly enable your users to access applications from a broad range of mobile devices. Mobile IT delivers a native device experience without the need for either virtualization or custom development all without sacrificing security or usability. With Mobile IT, devices communicate through a secure HTTPS connection, and administrators can easily approve or disapprove devices attempting access as well as lock out devices reported lost or stolen.

    In this blog post I will walk you through the installation of the Mobile IT Components which was pretty easy if you have a simple scenario using Dell’s Gateway to connect to your Mobile IT Server and Agent.

    High-Level Installation steps:

    1. Download Dell Mobile IT bits
      1. Mobile IT x64 with Prerequisites
      2. Microsoft System Center Operations Manager (SCOM)
      3. Release Notes
      4. Administrator Guide
    2. Installation of Mobile IT Components
      1. Installation Mobile IT Server and Agent
        For pre-reqs see Administrator Guide
    3. Installation of Operations Manager Mobile Pack
    4. Installation of Windows Phone Mobile IT App and configuration
    5. Configuration of the Mobile IT Connector within Operations Manager

    Architecture of Mobile IT Solution:

    • Mobile IT Server
      Provides a connection between Mobile IT Agents and your mobile devices, and is usually installed on a dedicated computer with access to the Internet
    • Mobile IT Agent
      Works with the target system (such as GPOADmin, Server Management, TFS, etc.) and communicates with Mobile IT Server
    • Mobile Packs
      Mobile Pack includes functionality for working with a particular system
    • Mobile IT Client
      App for Android, iOS,Windows Phone, and Windows 8 devices that allows the user to communicate with Mobile IT Server

    Test Mobile IT Server\Agent Architecture:

    • Windows Server 2008 R2
    • System Center Operations Manager 2012 Management Server
    • SQL Server 2008 R2

    Simple Scenario

    Taken from Admin Guide

    clip_image001

    Installation of Mobile IT Server\Agent

    1. Unzip Quest_Mobile-IT-x64-with-Prerequisites_13.zip (439 MB)

    clip_image002

    2. Run QuestMobileIT_x64_1.3.2139.0.exe on Mobile IT Server\Agent (System Center Operations Manager Management Server)

    clip_image003

    clip_image004

    clip_image005

    clip_image006

    Selected Full install

    clip_image007

    clip_image008

    On the Management Server is already a SQL Server 2008 R2 Instance installed.

    clip_image009

    image

    image

    clip_image012

    clip_image013

    clip_image014

    clip_image015

    clip_image016

    3. Install Mobile Pack by unzipping Quest_Microsoft-Systems-Center-Operations-Manager-SCOM_118880.zip file

    clip_image017

    4. Import SCOM Mobile Pack using the Mobile IT Console

    image

    clip_image019

    image

    Click on Add Instance

    image

    5. Connect Mobile Devices (Windows Phone) to Mobile IT Server

    1. Launch the Mobile IT application on your mobile device and tap Sign In
      image
      image
      image

      image
    2. Approve device in Mobile IT Console

    image

    6. Configure the Mobile IT Connector
    image

    image

    image

    image

    image

    image

    image

    image

    And now waiting for the Operations Manager Alerts being forwarded to my Windows Phone. And yes Alerts are showing up on my Windows Phone 8 Smile

    image

    image

    image


    Conclusion:

    Installation process of the Mobile IT solution was pretty simple and straightforward, but I was missing information about the configuration of the Mobile IT Connector within Operations Manager.

    I hope find some time to start creating my own Mobile Packs using PowerShell. The Mobile IT development team has released the SDK that can be used by other product development teams to create their own Mobile IT server connectors.

    References:

  • Monitoring with Microsoft Monitoring Agent

    Microsoft Monitoring Agent is a new agent that replaces the Operations Manager Agent and combines .NET Application Performance Monitoring (APM) in System Center with the full functionality of Visual Studio IntelliTrace Collector for gathering full application profiling traces. Microsoft Monitoring Agent can collect traces on demand or can be left running, which monitors applications and collects traces. You can limit the disc space that the agent uses to store collected data. When the amount of data reaches the limit, the agent begins to over-write the oldest data, storing the latest in its place.

    Microsoft Monitoring Agent can be used together with Operations Manager or can be used as a standalone tool for monitoring web applications written with Microsoft .NET Framework. In both cases, the operator can direct the agent to save application traces in an IntelliTrace log format that can be opened in Visual Studio Ultimate. The log contains detailed information about application failures and performance issues.

    You can use Windows PowerShell commands to start and stop monitoring and collect IntelliTrace logs from web applications that are running on Internet Information Services (IIS). To open IntelliTrace logs generated from APM exceptions and APM performance events, you can use Visual Studio. For information about supported versions of IIS and Visual Studio, see Microsoft Monitoring Agent Compatibility.

    To install Microsoft Monitoring Agent from the Download Center for standalone monitoring go to download page on the Microsoft Download Center.

    Read more here

  • 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!

  • PowerShell v4 Desired State Configuration Cheat Sheet

    If you are interested in the new PowerShell v4 feature Desired State Configuration you can download a Cheat Sheet at the Microsoft Download Center.

     

    PPT version or PDF version

     

    image

  • What is SMA and why is it important in the world of PowerShell?

    One of the many blogposts on my todo list is about SMA (Service Management Automation) but I’m just too busy to blog right now. So sorry for the lack of blogposts lately. Did I mention we are looking for Premier Field Engineers in the Netherlands? Winking smile

    Service Management Automation is a feature of the management portal for administrators in Windows Azure Pack for Windows Server. You can use it to automate administrative tasks in the management portal. You automate your tasks by using runbooks, which run Windows PowerShell commands. You can also use a runbook to run another runbook within its workflow. When the secondary runbook is finished, runbook implementation returns to the calling runbook.

    Jim Britt a Senior Program Manager for the Windows Server System Center CAT Team at Microsoft has posted a blogpost the PowerShell Magazine blog explaining what SMA is and why it is important in the world of PowerShell.

    Check it out!

  • System Center 2012 R2 Operations Manager

    Hi people, it’s there. The new release of System Center 2012 R2 Operations Manager RTM. Go to MSDN and start your downloads just after you installed Windows 8.1 Smile

    image

  • Window Key combinations in Remote Desktop Sessions

    This time not a blog post about System Center but a blog post  on how to use Windows Key Combinations in Remote Desktop Sessions.

    I really love to use Windows Key Combination on my Windows 8 and Windows 2012 machines and one of my most favorite combinations is the Win+X combination. Check here for a great overview of the Windows Key Combinations.

    But last week I connected to one of my remote machines using a Remote Desktop Connection and my Windows Key combinations did not work in the RDP session. And instead of searching for more information I thought about using PowerShell and some PInvoke to use Windows Key combinations and I got something working Smile Check the video and the example code I used to achieve this.

    But one Windows Key combination was not working and that was my favorite Win-X combination. Sad smile

    And after asking around internally and via social media I got some great tips on how to use Windows Key combinations in RDP Sessions using different RDP Clients.

    If you are using Remote Desktop Connection Manager you can configure your setting for the Local Resources Tab for the Server Properties.

    image

    If you are using the mother-of-all RDP Clients Royal TS you can even do more! Royal TS is a simple, yet powerful tool for administrators, developers, system engineers and many other IT focused information workers that supports them in working effortless with their remote systems or management consoles.

    image

    What I love about Royal TS that you have some Remote Action buttons to open the App Bar, Charms, Snap, App Switch and Start menu. How cool is that?

    image

    Enjoy using your Windows Key combination both locally and remotely!

  • New great blog about System Center

    One of my great PFE colleagues out based in Australia, Wei Lim started to blog and I can highly recommend to add his blog to your RSS Reader.

    Wei Out There with System Center is the name of his blog and this is already the list of posts he published the last month.

    Wei keep up the great work!

  • 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

  • Finding Referenced Management Packs

    Today I was helping a customer with some OpsMgr MP authoring and you sometimes need to find a Referenced Management Pack before you can edit a MP in the Authoring Console.

     

     

    image

     

    It’s sometimes difficult to find the correct Version of a MP if you have stored different versions on your system. The fastest way to find the correct version for a Referenced Management Pack is using PowerShell.

    We used the following script to search the D:\Temp\MPs folder and subfolders to search for the correct Reference MP.

    Get-ChildItem -Path "D:\Temp\MPs" -filter "Microsoft.SystemCenter.NTService.Library.mp" -Recurse | 
        select-Object -ExpandProperty VersionInfo | 
            Where-Object {$_.FileVersion -eq "6.0.5000.0"} | 
                Format-Table FileName, FileVersion -AutoSize

    Have fun!

  • 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.

  • Failing OM2012 Gateway Server installation

    This week I needed to install a OM2012 Gateway Server in my demo environment (Windows Server 2012 standard) and the installation was failing with the following error.

    clip_image002

     

    After adding the .NET Framework 3.5 using PowerShell the installation was successful.

     

    clip_image002[4]

    image

  • OpsMgr 2012 R2 new PowerShell Cmdlets

    Because I’m pretty busy lately I’ve not been able to blog about the new OpsMgr 2012 R2 Cmdlets, but check Stefan Roth’s blogpost about this subject.

    Keep up the great work Stefan!

  • 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!

  • New OM2012 PowerShell Function (Remove-SCOMRule)

    Today I got a question from my fellow Premier Field Engineer Anders Bengtsson if I could help him with an OpsMgr PowerShell script he was creating for an Orchestrator Runbook he started to create. And while waiting for a PowerShell workshop I was about to deliver I booted my OM2012 servers and had a look at his PowerShell script.

    He wanted to be able to delete an OpsMgr Rule using PowerShell. As you may know there is no Remove-SCOMRule Cmdlet or function available in the PowerShell OperationsManager Module. Let’s check to be sure.

    image

    No, we can disable, enable and get a SCOMRule but there is no Remove-SCOMRule Cmdlet.

    So, if there is none, let’s create one!

    First let’s have a look at the parameters for the Get-SCOMRule, we may could use the same parameters in our Remove-SCOMRule Function.

    Get-Help Get-SCOMRule -Detailed

     

    image

    Looking at the list of parameters the Get-SCOMRule is using we start simple using the DisplayName and Name parameters for our new Remove-SCOMRule function.

    Here is a function you can use and tweak to Remove SCOM Rules in your OM2012 environment.

    <#
    .Synopsis
       Removes a list of monitoring rules.
    .DESCRIPTION
       The Remove-SCOMRule removes a list of monitoring rules.
    .EXAMPLE
       Remove-SCOMRule -DisplayName "test rule"
    .EXAMPLE
       Get-SCOMRule -Name "MomUIGeneratedRule2c30f12ddfb6493fbd0c92e41db94495" | Remove-SCOMRule -Verbose
    
    #>
    function Remove-SCOMRule
    {
        [CmdletBinding(SupportsShouldProcess=$true)]
        Param
        (
            # Specifies the name of the object
            [Parameter(Mandatory=$true,
                       ValueFromPipelineByPropertyName=$true,
                       Position=0)]
            [string[]]$Name,
    
            # Specifies the displayname of the object
            [Parameter(Mandatory=$false,
                       ValueFromPipelineByPropertyName=$false,
                       Position=1)]
            [string]$dislayname
        )
    
        Begin
        {
            Write-Verbose "Starting Function Remove-SCOMRule"
    
    
        }
        Process
        {
            #Create Hashtable for Get-SCOMRule Cmdlet parameters
            if ($name)
            {
                $parms = @{'name'=$name}
            }
            else
            {
                $parms = @{'displayname'=$displayname}
            }
            
            Write-Debug "`$parms: $parms"
    
            $Rule = Get-SCOMRule @parms
            Write-Verbose "Removing Rule: $($Rule.DisplayName)"
            $MP = Get-SCOMManagementPack -Name ($Rule.ManagementPackName)
            $MPObject = $MP.FindManagementPackElementByName($Rule.Name);
            $MPObject.Status = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementStatus]::PendingDelete
            $MP.AcceptChanges()
    
        }
        End
        {
            Write-Verbose "Finished Function Remove-SCOMRule"
        }
    }

    How to use this function?

    1. Save the above PowerShell Function in a script.
    2. Dot source (dot space scriptname location) the script where you have stored above function. And look at the help.

    image

     

    Now we can use the Get-SCOMRule Cmdlet to retrieve the Rule and pipe it to the Remove-SCOMRule Function. You can even remove multiple Rule in one go if you retrieve multiple rules using the Get-SCOMRule Cmdlet.

    image

     

    Remarks:

    • Function only work when the OperationsManager Powershell module is loaded in PowerShell session.
    • This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.  THIS SAMPLE CODE AND
      ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
      LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.  We grant You a nonexclusive, royalty-free
      right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, provided that You agree:
      (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; (ii) to include a valid
      copyright notice on Your software product in which the Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and
      Our suppliers from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of the Sample Code.