Remko Weijnen's Blog (Remko's Blog)

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

Archive for the ‘PowerShell’ Category

Recently support for NPAPI has been removed from Google Chrome. While understandable from a security point of view it does mean that some plugins no longer work.

A good example is VMware’s Client Integration Plugin where we’ve lost the ability to upload an ovf template. While VMware has published a fix for vCenter (see this kb), it has not been fixed for vCloud Director:

The attempted operation cannot be performed using this browser. Re-try using an alternative method:

- Use the VMware OVF Tool to perform the operation. You can download the OVF Tool and its User Guide from the OVF Tool product page at
- Use a browser and platform combination that is supported by vCloud Director for this operation. For the supported browser and platform combinations, see the Release Notes for this version of vCloud Director.


In versions prior to 6.0 VMware supplied the VCSA (vCenter Server Appliance) as an OVF template that could be imported directly.

Starting with version 6.0 the installation process has changed and now consist of an .iso file containing a custom, HTML based, installer. Vladan Seget has a nice blog post where he describes the installation.

This installation process is annoying, it needs a separate client (Windows) machine to run the installer on, requires the Client Integration Plugin (which doesn’t appear to run well on chrome now that support for npapi/dpapi has been removed):
Please install the Client Integration Plugin 6.0 provided in the vCenter Server Appliance ISO image (requires quitting the browser)

But even worse is that we cannot import VCSA 6.0 in vCloud Director. Even converting the OVF inside the iso file doesn’t help because vCloud directory lacks support for Deployment Options.


ShareFileLogoThe Citrix ShareFile Sync application is quite limited in functionality, one of those limitations is that you can only synchronize to a single (one) local folder.

As Helge Klein wrote in his excellent article "Configuring Citrix ShareFile Sync from PowerShell" this is simply a GUI restriction and not a restriction in the actual ShareFile sync engine.

Helge describes that you can easily do this in PowerShell with the following example:

While the command was accepted, nothing was synchronized.


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.


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.


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


RC4 Encryption in PowerShell

For an upcoming blog post I needed to decrypt some data using the rc4 algorithm. I wanted to do this with PowerShell but sadly PowerShell and the .NET framework have no functions for it.


So I needed to implement it (download at the bottom of the post):


  • 1 Comment
  • Filed under: PowerShell
  • For an upcoming Blog post I needed to convert a Byte Array to a Hex string in PowerShell and vice versa.

    PowerShell doesn’t come with HexToBin or BinToHex functions so here’s my attempt at it:


  • 1 Comment
  • Filed under: PowerShell
  • Parse RES Building Blocks with PowerShell

    Customer uses Citrix XenApp 5 with ThinApp, RES Workspace Manager and RES Workspace Extender.

    An application integration strategy is defined, the picture below displays the strategy and preferred order:


    Customer wanted to know the type (1..7) for all applications currently defined in RES Workspace Manager.

    I decided to export all the Applications from RES WM as Building Blocks. This results in a folder with XML files. I decided to parse the XML files with a PowerShell script.


    A customer had partially implemented a (written) policy in the past where the the Local Administrator account was renamed according to a special convention.

    This policy stated that the Administrator account needed to be renamed to admin with the computername as a prefix.

    However they didn’t know exactly on which machines this policy had been applied to in the past. I was asked to write a script that would check a list of machine names, query the Administrator account name and write this in a new list.

    The Administrator account has a Well Known SID of S-1-5-21-xxxxxxx-500 where xxxxxxx is the SID of the computer.