Remko Weijnen's Blog (Remko's Blog)

About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like

Archive for July, 2014

Handling ini files in PowerShell

Ini File IconThis morning Aaron Parker was wondering if Hash Tables could be used to work with ini files:

Aaron Parker | @stealthpuppy | @remkoweijnen @msh_dave need to see if this approach works for editing INI files

I thought it was a great idea because in Hash Tables you can use the . operator to get or set a Hash Table entry. But I wondered what to do with sections in ini files. Then I got the idea to use nested Hash Tables for that.

The result is two functions, one to read an ini file into a nested Hash Table and one function to write it back to an ini file.

(more…)

  • 2 Comments
  • Filed under: PowerShell
  • In a PowerShell script I needed to sort a hash table by byte value (not alphabetically, lowercase parameters will be listed after uppercase ones). An example for this requirement is the Amazon Product Advertising API.

    Consider the following hashtable as an example:

    If we use the Sort-Object to order the list (note that we need to use the GetEnumerator method):

    We will get the following result:

    If you use the -CaseSensitive switch the resulting order will remain the same.

    (more…)

  • 4 Comments
  • Filed under: PowerShell
  • Get Actual CPU Clock Speed with PowerShell

    To get the best performance out of Virtual Desktops it is essential that the power configuration in the system BIOS and the HyperVisor are configured for maximum performance.

    Many people have blogged about the importance of these settings like, Andrew Wood, Helge Klein and Didier Van Hoye. So I will not go into details again.

    But how do you check from a Virtual Machine if you are actually running at full clock speed or not?

    I have written a PowerShell script to do just that (requires at least PowerShell v3).

    Here are some screenshots:

    Running with "High Performance profile":

    CPU Clock Speed with d"High Performanced" Power Profile

    Running with "Balanced" power profile:

    CPU Clock Speed with High Performance Balanced Profile

    (more…)

  • 2 Comments
  • Filed under: PowerShell
  • System Center Operations Manager LogoIn a SCOM Management Pack Custom Properties can be used for Alert Description and Notification as described in this blog by Kevin Holman.

    In my case I wanted to add the Display Name and the Performance Counter Value in a Performance Threshold Monitor. In XML it would look this this:

    But how to add these parameters when using the System Center 2012 Visual Studio Authoring Extensions?

    (more…)

    Sophos UTM IconI am currently implementing Sophos UTM and I quite like this solution. It is free up for home usage and can easily be installed on a hypervisor.

    I wanted to scan encrypted traffic (ssl) as well so I activated the "Decrypt and scan" option:

    image

    When testing this on one of my iPad’s I noticed that the App Store didn’t work properly anymore.

    When I tried to update applications I got the following error: "Cannot connect to iTunes Store". Additionally when I searched for Apps the search would return no results.

    (more…)

    System Center Operations Manager LogoToday I encounterd what seems to be a bug in the System Center 2012 Visual Studio Authoring Extensions. I wanted to define a Performance Collection Rule that reads out the percentage of free memory from an SNMP device.

    Since the device returns only the percentage of used memory I needed to use the ComputedPerfProvider provider to substract the used memory percentage from 100.

    I could of course report used memory instead of free memory but I wanted the resulst to appear in the default SCOM Performance View, which only lists Free Memory:

    System Center Operations Manager | Default Performance View

    (more…)

    System Center Operations Manager LogoI am currently working on a Management Pack for SCOM and I have studies a few examples on adding processor and memory counters.

    These examples all reference a Management Pack named "System.NetworkManagement.Monitoring.mp" but this Management Pack is not bundled with the System Center 2012 Visual Studio Authoring Extensions.

    (more…)

    I am currently working on a Management Pack for System Center Operations Manager (aka SCOM). I am using the System Center 2012 Visual Studio Authoring Extensions and during build of my project I suddenly got the following error: “MSB4018: The “MergeFragments” task failed unexpectedly“:

    Visual Studio | System Center 2012 Visual Studio Authoring Extensions | C:\Program Files (x86)\MSBuild\Microsoft\VSAC\Microsoft.SystemCenter.OperationsManager.targets(234,5) | error MSB4018: The "MergeFragments" task failed unexpectedly.

    I searched on this error message but wasn’t able to find anything helpful. In order to get more detailed output from MSBuild I changed the MSBuild project build output verbosity. To do this go to the Tools menu in Visual Studio and select Options. Navigate to the “Build and Run” node under “Projects and Solutions” and set both options to “Diagnostic”:

    Visual Studio | Tools | Options | Projects and Solutions | Build and Run | MSBuild project build output verbosity | Diagnostic

    (more…)

    Blogroll


    Categories


    Archives