• 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


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


    Step 2: Add a Widget to Dashboard created above


    Select the PowerShell Grid Widget


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


    [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


    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!

    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!

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


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


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


    Click on open


    Select the chocolateyInstall.ps1 file and right-click


    Select View Content

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


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