Remko Weijnen's Blog (Remko's Blog)

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

Archive for the ‘PowerShell’ Category

imageAs you may heard, the API’s returning the Operating System version have changed, started with Windows 8.1 and Server 2012 R2.

The reason for this change is Application Compatibility but let’s take a little closer look into this why.

As an application developer there may be a need to check the version of the OS you’re running on. A typical example is when you are using an API that only works on a specific Windows version (and up). Or the other round, you’re not supporting an older version of Windows (say Windows XP as an example).

A common error in such version checks is to check for a specific Windows version but forget to take new (not yet released) versions into account.

(more…)

  • 1 Comment
  • Filed under: PowerShell
  • Just a very quick post (more like a note to self) but I wanted to split a string with the $ sign in PowerShell:

    Took me a little while to realize that this doesn’t work as the split operator in Windows PowerShell uses a regular expression in the delimiter, rather than a simple character.

    The easy fix is to Escape the $ sign with a backslash:

    Or alternatively use the SimpleMatch option:

    The 0 represents the “return all” value of the Max-substrings parameter. You can use options, such as SimpleMatch, only when the Max-substrings value is specified.

    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 https://www.vmware.com/support/developer/ovf/.
- 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.

    (more…)

    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.

    (more…)

    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.

    (more…)

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

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

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

    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.

    File:RC4.svg

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

    (more…)

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

    (more…)

  • 1 Comment
  • Filed under: PowerShell
  • Donate


    Blogroll


    Categories


    Archives