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

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

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

  • Free System Center 2012 R2 Operations Manager Management Pack training from MVA

    Want to expand your knowledge about service packs? In this course, Microsoft experts will drill down into the structure, implementation, and development of management and service packs and their tools. There will be a series of 28 modules with staggered release dates, so keep checking back for new modules to become available.

    Go to the Microsoft Virtual Academy and start this course.

    Have fun!

  • New Windows PowerShell Best Practices book by Ed Wilson

    Warning! This is a shameless plug to buy the latest version of Ed Wilson’s Windows PowerShell Best Practices book. Smile

    But I’ve a great reason because I made a very small contribution to the book and I’m pretty proud to say the least.

    image

    And to make it an even better deal you can get a discount on the eBook.

    Use discount code: WKPWERS
    This deal expires January 31, 2014 at 5:00am PT and cannot be combined with other offers. Offer does not apply to Print, or "Print & Ebook" bundle pricing.

    Go check it out on O’Reilly.

    Have fun!

  • Dutch Windows Management User Group event on 12 February 2014

    On the 12th of February 2014 the Dutch Windows Management User Group (WMUG NL) is organizing an event about Monitoring.

    I’ll also present a session about this topic Smile

    Session title: Using PowerShell with System Center Operations Manager 2012 R2

    Description:  Introduction on how to use PowerShell to manage System Center Operations Manager 2012 R2.
    In this session we walk through the PowerShell System Center Operations Manager 2012 R2 module and learn some basic PowerShell. We start with a short introduction to PowerShell and learn how to use the Operations Manager PowerShell cmdlets.

    If you are interested to attend this event please visit the Windows Management User Group website. (in Dutch)

    Hope to see you there or on some other event.

  • Windows Azure Pack–Where to start?

    The Windows Azure Pack is a collection of Windows Azure technologies available to Microsoft customers at no additional cost. Once installed in your datacenter, the Windows Azure Pack integrates with System Center and Windows Server to help provide a self-service portal for managing services such as websites, Virtual Machines, and Service Bus; a portal for administrators to manage resource clouds; scalable web hosting; and more.

    If you want to learn more about Windows Azure Pack (WAP) where do you need to start? The best place to start is the Microsoft Technet wiki page for WAP

    And to make it even easier I would suggest you to watch the 1:14 minutes video Building Cloud Services with Windows Server 2012 R2, Microsoft System Center 2012 R2 and the Windows Azure Pack recorded during TechEd Europe 2013.

    It has some great demos about Azure Consistent Experiences, Virtual Machines, VM Clouds Administration,Automation (SMA), Usage Metering and Service Reporting.

    After watching this video you should be able to understand more about WAP and related concepts like Service Management Automation.

    The Windows Azure Pack is free if you have licenses for System Center and Windows Server.

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

  • New PowerShell Grid Widget Walkthrough

    With the release of UR2 for System Center 2012 R2 we included updates for the Widgets which allow you to create richer dashboard visualization within Operations Manager.

    More information about the new list of Widgets can  be found here: http://social.technet.microsoft.com/wiki/contents/articles/24133.operations-manager-dashboard-widgets.aspx

    One of the more interesting new Widgets in my opinion are the PowerShell Grid Widgets:

    • PowerShell Grid Widget
    • PowerShell Web Browser Widget

    The PowerShell Grid Widget displays the results of a Windows PowerShell script in a grid.  The script is run when the dashboard is opened and each time the component is refreshed. 

    The script will run on the computer with the console and will typically use the Operations Manager SDK (not in this walkthrough) to access a management server and retrieve information from the management group.  It must then use the ScriptContext object to create a Data Object and return it using the ReturnCollection method.

    The PowerShell Web Browser Widget displays the output of a web page retrieved by a PowerShell script.  The script is run when the dashboard is opened and each time the component is refreshed.

    The script will run on the computer with the console and should create a Data Object using Request type defined in Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema.  You specify the Url by setting the BaseUrl property.  The request is sent to the site and the resulting output delivered to the dashboard when the ReturnCollection method of the ScriptContext object.

    In this blog post I will guide you through the creation of PowerShell Grid Widget to retrieve the latest blog posts from the System Center: Operations Manager Engineering Blog using PowerShell to retrieve the RSS feed for this blog.

    Step 1: Create a New Dashboard and Widget

    image

    Select the layout for this dashboard. In this case we are going to have a single cell dashboard

    image

    Step 2: Add a Widget to Dashboard created above

    image

    Select the PowerShell Grid Widget

    image

    After entering the General Properties for the Widget we need to add the PowerShell script we are going to use for the Grid

    image

    [xml]$Feeds = Invoke-WebRequest -Uri "http://blogs.technet.com/b/momteam/atom.aspx" $Entries = $Feeds.feed.entry | select title, @{LABEL="Published"; EXPRESSION={[datetime]$_.Published} } | Sort-Object -Property Published -Descending foreach ($Entry in $Entries) { $Title = $Entry.title $Published = $Entry.published $dataObject = $ScriptContext.CreateInstance("xsd://foo!bar/baz") $dataObject["Id"] = $Title.ToString() $dataObject["Title"] = $Title $dataObject["Published"] = $Published $ScriptContext.ReturnCollection.Add($dataObject) }

    Save the Grid and open the Dashboard in the Monitoring Pane of the Console

    image

    If you want to learn more about using the new Widgets part of the new UR2 for OM2012 R2 you can download the Word document attached at the New Widgets and Dashboard blog post.

    Have fun exploring the new Widgets and Dashboards!

    Disclaimer:
    This example is provided “AS IS” with no warranty expressed or implied. Run at your own risk.
    The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of Microsoft.

    **Always test in your lab first**  Do this at your own risk!! The author will not be held responsible for any damage you incur when making these changes!

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

    :

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

  • New release from Silect: MP Author SP1

    Yesterday Silect released a new version of their 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.

    I did a short first test and one of the things working in this version is editing the XML Smile

    image

    There are probably more improvements I’ve not checked but make sure you download this new version from their website!

    Also check my previous blog post about this great tool.

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

  • Top Support Solutions for System Center 2012 Operations Manager

    Did you know we have a blog about the Top Support Solutions from our Support Engineers? There you can also find the Top Support Solutions for System Center 2012 Operations Manager.

    There is not only a blog where you can search for the Top Support Solutions for different products but now there is also app available in the Windows Store.

    The app is available for free on the Windows Store, and connects users to product posts on the Top Support Solutions blog. These posts contain our best content associated with our top support topics.

    View in Windows Store

    image

  • Are you attending TechEd 2014? Interested in meeting with the OpsMgr Product team?

    The System Center: Operations Manager Engineering Blog posted a blog post with a survey.

    “We wanted to gauge our OpsMgr Customers interest in doing an informal round table discussion with OpsMgr product team to influence the future of this product.

    If you are planning to attend TechEd 2014 in Houston could you please take this quick survey to let us know. If there is enough interest we will setup a meeting and details on this event will be posted to this blog site.”

    Go to the blog post and answer the survey if you are interested.

  • Viewing NuGet Packages with the NuGet Explorer

    You may have seen that we released the the Windows Management Framework V5 Preview and that one of the new features  is Windows PowerShell OneGet. OneGet is designed to dramatically simplify how you discover and install software packages.

    Windows PowerShell OneGet

    OneGet is a new way to discover and install software packages from around the web. With OneGet, you can:

    • · Manage a list of software repositories in which packages can be searched, acquired, and installed
    • · Search and filter your repositories to find the packages you need
    • · Seamlessly install and uninstall packages from one or more repositories with a single PowerShell command

    This first version of OneGet installs and searches software from Chocolatey repositories.  Support of additional repositories will come in subsequent versions.

    What is Chocolatey?

    Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with Windows in mind.

    What is Nuget?

    NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.

    One of the things that comes getting up in discussions about using Chocolatey Packages with or without OneGet is the question how can I trust the Packages from a resource like Chocolatey? The Chocolatey Nuget Packages are build by the community so you need to be careful what you are downloading and installing like all other software from sources you don’t own yourself.

    But what if there is a easy way to view the content of NuGet Package before installing the Chocolatey NuGet packages? And that is possible using the NuGet Package Explorer.

    The NuGet package explorer tool which lets you view the metadata of a .nupkg package. After installing it, you can double click on .nupkg packages to open them in Package Explorer.

    After installing the NuGet Package Explorer you can choose what to do.

    image

    Let’s open a package from the Online Chocolatey Feed.

    image

    Search the Package you are interested in to install. (like 7zip)

    image

    Click on open

    image

    Select the chocolateyInstall.ps1 file and right-click

    image

    Select View Content

    You can now see all the metadata that’s within the Chocolatey NuGet Package of 7zip.

    image

    Do you now have enough info to decide if you want to install 7zip using Chocolatey or the new OneGet Module?

    References:

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

  • Interesting announcements during TechEd North America 2014

    I don’t know if you have noticed but we are this week hosting our TechEd North America 2014 event in Houston, Texas.

    TechEd North America is Microsoft’s premier technology conference for IT Professionals and Enterprise Developers, providing the technical education, product evaluation, and community resources to plan, architect, deploy, manage and secure a connected enterprise.

    While not being present on TechEd I tried to follow some of the interesting announcements made. These are the ones I found most interesting.

    Operations Manager Announcements:

    • Microsoft System Center Advisor – Limited Public Preview.
      System Center Advisor is an online service that analyzes installations of Microsoft server software. Advisor collects data from your installations, analyzes it, and generates alerts that identify potential issues (such as missing security patches) or deviations from identified best practices with regard to configuration and usage. Advisor also provides both current and historical views of the configuration of servers in your environment.

      This new preview we are introducing an new Dashboard based on HTML5 and we introduce Intelligence Packs. We even have a gallery which contains these “intelligence packs” which contain rich knowledge and visualizations for capacity planning, security, diagnostics, and configuration assessment.

      System Center Advisor – Limited Preview gathers data from your on-premise installation and provides rich intelligence. There is no hardware, software, or applications to install, manage or upgrade – everything is cloud-based.

    Sign up here: https://preview.systemcenteradvisor.com/

    Azure Announcements:

    PowerShell Announcements:

    This new package installs exclusively on Windows 8.1 and Windows Server 2012 R2. 

    PowerShellGet is a new way to discover, install, and update PowerShell Modules.

    If you have not yet downloaded or installed WMF 5.0 Preview May 2014 you should do it now.

    I already downloaded and installed the preview and it’s so cool to be able to discover and install new PowerShell modules.

    image

    image

    And while this was not an official announcement Jeffrey Snover introduced PowerShell DSC for Linux.
    image

    How cool is this? Smile

    In case you missed some of the interesting new from TechEd I suggest you go to our Channel 9 video channel and start watching some of the great sessions.

    I already suggest you watch the following sessions on Channel 9:

    Windows PowerShell Unplugged with Jeffrey Snover

    Come learn PowerShell the way PowerShell was meant to be learned—exploring Windows from the console. In this session, Distinguished Engineer Jeffrey Snover starts with the Get-Help cmdlet and shows you the tools and techniques to teach yourself PowerShell. Jeffrey’s contention is that most people still haven’t realized the power of what was delivered in PowerShell V1 so advanced users are likely to learn as much as day zero beginners.

    Channel 9 Live: Windows Azure Pack Automation

    Symon Perriman with Charles Joy

    Channel 9 Live: The Differentiated IT Professional

    Rick Claus with Jeffrey Snover, Distinguished Engineer

    Channel 9 Live: Microsoft Azure with Mark Russinovich

    Rick Claus with Mark Russinovich, Technical Fellow.

    Windows PowerShell Best Practices and Patterns: Time to Get Serious

    Based on results from the 2013 Scripting Games and a summer-long community engagement, this session presents the practices and patterns that the Windows PowerShell community has identified as the most important for creating stable, performant scripts and tools.

    Let’s start with those first Smile

    Have fun!

  • OpsMgr Program Managers on Twitter

    I guess you already know I’m pretty active on Twitter but since recently an number of OpsMgr (Program) Managers have joined the Twittersphere. You can now start following them on Twitter and ask them to improve your favorite products Winking smile

    Joseph Chan (Principal Program Manager

    Daniele Muscetta (Program Manager)

    Daniel Savage (Principal Program Manager)

    Liz Kim (Program Manager)

    Sacha Dawes (Business Manager)

    For your convenience I also created a Twitter List for the OpsMgr Program Managers

    If I’m someone missing please let me know.

    See you on Twitter Smile

  • Update: Using PowerShell OData Provider Module for OneGet and PowerShellGet

    Update 03/13/2015: the PowerShell gallery is moved from msconfiggallery.cloudapp.net to powershellgallery.com

    After playing with OneGet and PowerShellGet for some time now I wanted to dive into the OData feed that both new PowerShell v5 preview features are using.

    Let me first summarize OneGet and PowerShellGet.

    OneGet is a new way to discover and install software packages from around the web. With OneGet, you can:

    • ·Manage a list of software repositories in which packages can be searched, acquired, and installed
    • · Search and filter your repositories to find the packages you need
    • · Seamlessly install and uninstall packages from one or more repositories with a single PowerShell command

    This first version of OneGet installs and searches software from Chocolatey repositories.  Support of additional repositories will come in subsequent versions.

    PowerShellGet is a new way to discover, install, and update PowerShell Modules.  New in WMF 5.0 Preview May 2014, PowerShellGet contains a set of cmdlets that enable users to interact with an online module gallery.Instead of having to search through CodePlex, GitHub, various blogs, and TechNet Script Center for all the PowerShell Modules you want, you can use Find-Module to search through an online Gallery

    Both use an OData feed, Open Data Protocol (OData) is a data access protocol initially defined by Microsoft. The protocol was designed to provide standard CRUD access to a data source via a website. If you want to learn more about OData just go to wikipedia.

    Now we know, we can access the OneGet and PowerShellGet repositories using an OData feed we can use the PowerShell OData Explorer. With the 'OData Explorer' PowerShell application we can browse the OData Services. After downloading and unzipping the OData Explorer we need to add the two OData Services from OneGet and PowerShellGet in the ODataServices.csv file.

    PowerShell OData Explorer

    image

    image

    Name, uri
    NetFlix,    "http://odata.netflix.com/Catalog"
    Northwind,  "http://services.odata.org/Northwind/Northwind.svc/"
    TechEd2010, "http://odata.msteched.com/sessions.svc/"
    WorldCup,   "http://www.openligadb.de/Webservices/OData.svc/"
    StackOverflow, "http://odata.stackexchange.com/stackoverflow/atom"
    SuperUser, "http://odata.stackexchange.com/superuser/atom"
    ServerFault, "http://odata.stackexchange.com/serverfault/atom"
    "Meta StackOverflow", "http://odata.stackexchange.com/meta/atom"
    Locations, "http://ogdi.cloudapp.net/v1/dc"
    Chocolatey, "http://chocolatey.org/api/v2/"
    Nuget, "http://www.nuget.org/api/v2/"
    PowerShellget, "https://powershellgallery.com/api/v2

    Open the .\View-OData.ps1 PowerShell script and start browsing.

    image

    You can browse the Chocolatey or NuGet OData feed for the OneGet Packages or for the PowerShell Modules you can browse the PowerShelGet OData feed.

    image

    After browsing through the OneGet and PowerShellGet OData repositories would not it be cool if we can “just” navigate those OData feeds like we do with our other PowerShell Providers?

    OData PowerShell provider

    This can be done using the PowerShell OData Provider Module. The OData PowerShell provider allows you to mount OData feeds as drives in your powershell session. This enables simple and intuitive access to the catalogs, collections, and entities in the feed using the same cmdlets you use for working with files. Download, unzip and install the PowerShell OData Provider and get started navigating your OneGet and PowerShellGet OData feed just like any other PowerShell Provider.

    001
    002
    003
    004
    005
    006
    007
    008
    009
    010
    011
    012
    013
    014
    015
    016
    017
    018
    019
    020
    021
    import-module OData

    #Get-Help on OData queries
    get-help about_OData_Query

    #Create an new OneGet Drive
    New-PSDrive -Name OneGet -PSProvider OData -Root "http://chocolatey.org/api/v2/"

    #Go to OneGet Drive
    cd OneGet

    #Search for latest 7zip package
    get-childitem OneGet:/packages -orderby Version -filter "Title eq '7zip'" -top 1

    #Create an new PowerShelGet Drive
    New-PSDrive -Name PowerShellGet -PSProvider OData -Root "https://powershellgallery.com/api/v2"

    #Search top PowerShell Module downloads from PowerShellGet Repository
    get-childitem PowerShellGet:/packages | 
       
    where-object {$_.Islatestversion -eq "$true"} | 
       
    select-object name, @{Label="Downloads";Expression= {[int]$_.Downloadcount}}| sort Downloads -Descending

    image

    Have fun browsing those PowerShellGet and OneGet OData feeds using the PowerShell OData Provider Module.

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

  • Creating a PowerShell Script Gallery Upload Add-On – Part 1

    Some weeks ago I started a discussion on Codeplex requesting an option to upload your PowerShell scripts to the TechNet Script Center being part of the Microsoft PowerShell Script Browser.

    .One of the main features in the Script Browser is to search, download, and learn script examples from the TechNet Script Center.

    image

    Until now most of the scripts I create are shared on Github.Mainly because it’s pretty simple to upload scripts to my Github repository. But the more scripts I and you upload to the Microsoft Script Center the more scripts can be found using the Script Browser.

    So instead of waiting for some responses on my discussion thread on Codeplex I tried to create a PowerShell ISE Add-On which makes it easier to upload your scripts from the PowerShell ISE to the Script Center.

    image

    The wish list for this ISE Add-On was the following:

    1. You must be able to easily upload your PowerShell script from PowerShell ISE. Easily means without leaving the ISE and not having to type to much information on the Upload page.
    2. You must be able to navigate on the Upload page from within the ISE
    3. You must be able to insert the file name into the File Upload text box with one click
    4. You must be able to insert as much as possible information available in the script to the Description field.
      As much as possible means the Script Comment Header information I always insert at the top of my PowerShell scripts.

    After reading below documentation I created a beta version of the PowerShell Script Gallery ISE AddOn on Github.

    You can test this beta version if you want.

    Steps:

    1. Download the v0.1-beta.zip file from the release folder.
    2. Unblock v0.1-beta.zip file.
    3. Extract v0.1-beta.zip to folder of choice.
    4. Run LoadScriptGalleryISEAddOn.ps1 from within the ISE.

    In the next part of this blogpost I’ll describe the steps I followed to create this PowerShell ISE Add-On.

     

    References:

  • PowerShell Grid Widget Helper

    I already blogged about the new PowerShell Grid Widget which came with the release of UR2 for System Center 2012 R2 where we included updates for the Widgets which allow you to create richer dashboard visualization within Operations Manager.

    If you look at the Walkthrough I created, there is a part where you need to create the PowerShell script that is being used for the PowerShell Grid Widget.

    The creation of the PowerShell script was not as straight forward as I would liked it to be. Would not  it be great if you could just have a PowerShell function where you would input your normal PowerShell script and which would generate the script needed for the PowerShell Grid Widget on the fly?

    I created a function that creates the script for the PowerShell Grid Widget with only a limited number of parameters.

    Let’s walk through a scenario.

    Scenario:
    Create a PowerShell Grid Widget for the top 10 OpsMgr Error eventlogs on the server where you have the console running in the last 24 hours.

    You would normally first start with a PowerShell script that retrieves the top 10 OpsMgr Error eventlogs on the Server where you have the Console running for the last 24 hours.

    Get-EventLog -LogName "Operations Manager" -After ((Get-Date).AddHours(-24))| where-object {$_.Entrytype -match "Error"} | Select-Object EventId,Source,Message | Group-Object EventId | Select-Object * -ExpandProperty Group | Select-Object count, EventId, Message -Unique | Sort-Object Count -Desc | Select-Object -first 10

    This would result in the following:

    image

    After we created the script we need to “store” our “normal” PowerShell script in a scriptblock and pass this to our new Show-PSGridWidgetCode helper Function and finally pipe the result to the clipboard so we can copy the script to the Console.

    $scriptblock = {Get-EventLog -LogName "Operations Manager" -After ((Get-Date).AddHours(-24))| where-object {$_.Entrytype -match "Error"} | Select-Object EventId,Source,Message | Group-Object EventId | Select-Object * -ExpandProperty Group | Select-Object count, EventId, Message -Unique | Sort-Object Count -Desc | Select-Object -first 10 } Show-PSGridWidgetCode -scriptblock $scriptblock -id Message | clip

    image

    image

    Result:

    image

    If you want to start playing with the new PowerShell Helper Function Show-PSGridWidgetCode you need to save the following script as PowerShellGrid.ps1

    # --------------------------------------------------- # Script: D:\PowerShellGrid_v0.3.ps1 # Version: 0.4 # Author: Stefan Stranger # Date: 05/19/2014 21:19:49 # Description: PowerShell Grid Widget Helper Function # Comments: With the latest OM2012 UR2 update new Dashboard Widgets have been added. # This helper function helps with the creation of the PowerShell script code needed Grid Widget # Links: http://blogs.technet.com/b/stefan_stranger/archive/2014/04/28/new-powershell-grid-widget-walkthrough.aspx # Know issues: # - First object in returned array will be used as ID property [solved] # - If a property of an object has multiple values this will not displayed correctly [solved] # Changes: [04-30-2014]: Added new Id Parameter. This should be an unique property of the objects # [05-19-2014]: Added string type to all output objects # Disclaimer: # This example is provided “AS IS” with no warranty expressed or implied. Run at your own risk. # **Always test in your lab first** Do this at your own risk!! # The author will not be held responsible for any damage you incur when making these changes! # --------------------------------------------------- Function Show-PSGridWidgetCode { <# .Synopsis Create Script code for use in new OM12R2 UR2 PowerShell Grid Widgets. .DESCRIPTION The output of this function can be copied to the Operations Manager Console to create the script code for creating the new PowerShell Grid Widgets. .EXAMPLE Show-PSGridWidgetCode -scriptblock {Get-Service | Select Name, Status} This command show the script code needed to create a PowerShell Grid Widget showing the Windows NT Services properties Name and Status on the machine where the console is running. You can copy the output to the console to have a head start creating the new Widget. PS C:\Scripts\PS> Show-PSGridWidgetCode -scriptblock {Get-Service | Select Name, Status} -Id "Name" $inputobject = Get-Service | Select Name, Status foreach ($object in $inputobject) { $dataObject = $ScriptContext.CreateInstance("xsd://foo!bar/baz") $dataObject["Id"] = ($object.Name).ToString() $dataObject["Name"] = ($object.Name).ToString() $dataObject["Status"] = ($object.Status).ToString() $ScriptContext.ReturnCollection.Add($dataObject) } #> [CmdletBinding()] Param ( # Inputobject parameter [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$false, Position=0)] [scriptblock]$scriptblock, # Name parameter [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$false)] [string]$id ) $properties = ((&$scriptblock | Get-Member -MemberType Properties).name) #Find properties with a collection of objects foreach ($property in $properties) { $property = $property -join "," $testherestring = @" `$dataObject["$property"] = [String](`$object.$property) "@ [string]$total += "$testherestring`n" } $script = @" `$inputobject = $scriptblock foreach (`$object in `$inputobject) { `$dataObject = `$ScriptContext.CreateInstance("xsd://foo!bar/baz") `$dataObject["Id"] = [String](`$object.$id) $total `$ScriptContext.ReturnCollection.Add(`$dataObject) } "@ $script }

    After saving the script you need to dot source the script (start the script like this . .\PowerShellGrid.ps1) (dot space dot)

    Now you can call the Show-PSGridWidgetcode Function from within PowerShell. I also added help for the Function.

    PS C:\Scripts\PS\OM2012\PowerShellGridWidget> help Show-PSGridWidgetCode -full
     
    NAME
        Show-PSGridWidgetCode
       
    SYNOPSIS
        Create Script code for use in new OM12R2 UR2 PowerShell Grid Widgets.
       
    SYNTAX
        Show-PSGridWidgetCode [-scriptblock] <ScriptBlock> -id <String> [<CommonParameters>]
       
       
    DESCRIPTION
        The output of this function can be copied to the Operations Manager Console to create the
        script code for creating the new PowerShell Grid Widgets.
       
     
    PARAMETERS
        -scriptblock< ScriptBlock>
            Inputobject parameter
           
            Required?                    true
            Position?                    1
            Default value               
            Accept pipeline input?       false
            Accept wildcard characters?  false
           
        -id <String>
            Name parameter
           
            Required?                    true
            Position?                    named
            Default value               
            Accept pipeline input?       false
            Accept wildcard characters?  false
           
        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
       
    INPUTS
       
    OUTPUTS
       
        -------------------------- EXAMPLE 1 --------------------------
       
        PS C:\>Show-PSGridWidgetCode -scriptblock {Get-Service | Select Name, Status}
       
       
        This command show the script code needed to create a PowerShell Grid Widget showing the
        Windows NT Services properties Name and Status on the machine where the console is running.
        You can copy the output to the console to have a head start creating the new Widget.
        PS C:\Scripts\PS> Show-PSGridWidgetCode -scriptblock {Get-Service | Select Name, Status} -Id "Name"
             $inputobject = Get-Service | Select Name, Status
             foreach ($object in $inputobject)
             {
                 $dataObject = $ScriptContext.CreateInstance("xsd://foo!bar/baz")
                 $dataObject["Id"] = ($object.Name).ToString()
                             $dataObject["Name"] = ($object.Name).ToString()
                 $dataObject["Status"] = ($object.Status).ToString()
                 $ScriptContext.ReturnCollection.Add($dataObject)
             }
       
       
       
       
       
       
    RELATED LINKS

    The ID parameter is used for the property that is being used as the unique key that is used in the PowerShell Grid Widget.

    Another example for retrieving SCOM Alerts with some filter criteria.

    $scriptblock = { Get-SCOMAlert -Criteria "ResolutionState = 0 AND Severity = 2 AND IsMonitorAlert = 1 AND (Owner <> 'Stefan' OR Owner IS NULL)" | Select Name, Severity, Priority, TimeRaised, ResolutionState } Show-PSGridWidgetCode -scriptblock $scriptblock -id Name | clip

    image

    Disclaimer:
    This example is provided “AS IS” with no warranty expressed or implied. Run at your own risk.
    The opinions and views expressed in this blog are those of the author and do not necessarily state or reflect those of Microsoft.

    **Always test in your lab first**  Do this at your own risk!! The author will not be held responsible for any damage you incur when making these changes!

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

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