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

  • 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

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

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