Monthly Archives: May 2014

Can we have “Latest” URLs for downloads, please!


I spend much time hunting for the latest version of software packages. This is part of my job as a consultant. I’m frequently setting up test, demo and prototype environments. I do this in order to keep myself in synch with new technologies. And to help others learn and use new technology.

I write presentations, demos, blog posts, instructions, howtos etc.

The Problem

As the release cycles gets shorter and shorter it is becoming increasingly hard to write good instructions. For example, If I need to explain how to install the latest “Windows Management Framework” I will need a very specific URL. (As of this writing the latest I have found is the may preview. )

If I put this URL in a wiki or blogpost it will be obsolete very quickly (the previous release of the WMF 5 preview was in april) and so I will have to either updare my blogpost or trust the user to find the correct latest version.

If I omit the URL and instead write a general instruction such as “Search Google for ‘Windows management Framework Download’” the user of my documentaton can end up with any version at all as is shown from these to examples from Bing and Google.

Search-bing Search-Gogle
Bing result Google result

NB: See how the Google search returns the next to latest edition, there is no trace of the latest version of the Windows Management Framework may preview.

This makes it very likely that whoever is following my written instruction will not end up with the latest version of Windows Management Framework.

The Solution

The solution that I would like to propose is that Microsoft start using a download URL constructed as this<product>/latest

Using Windows Management Framework as an example:

This URL would ensure that I get the latest release code, not the next best or whatever I find on Google, Bing, DuckDuckGo or wherever I am searching.

If I don’t want the bleeding edge I could use:

If I needed a specific version te URL could be similar to:

What this would require (I’m guessing now) is that somewhere within Microsoft a list of downloads would need to be mapped to the latest release code. The list of product names would need to be made into URL friendly shortnames (<product> in my example above). And the build processes for putting stuff on the Microsoft download sites would need to be adjusted so that it maps the “latest” to the most recently released piece of code.

I’m sure Microsoft have done more complex projects than this! Ler

So please Microsoft, give us more documetation friendly URLs!!!


What I propose above is nothing new. Many open source projects already do this. A good example is WordPress. It’s simple to write instructions for a user to get the latest WordPress, the URL is:

Let me know what you think! And even better, get this fixed Microsoft!

Installing Ubuntu 14.04 LTS as a Generation 2 Hyper-V guest

Since Microsoft release Windows Server 2012 R2 Hyper-V have had two different generations of virtual machines. The old “Generation 1” and the new “Generation 2”. Microsoft added generation 2 to get rid of the old stuff that really doesn’t make sense in a virtual world. And also to add new stuff. Generation 2 virtual machines provide the following new functionality:

  • PXE boot by using a standard network adapter
  • Boot from a SCSI virtual hard disk
  • Boot from aSCSI virtual DVD
  • Secure Boot (on by default)
  • UEFI firmware support

As can be expected all of these features worked fine straight away with Windows 8 (64-bit) and Windows Server 2012 or later. But they did not work well with Linux. Until now.

The fresh Ubuntu 14.04 LTS release works fine with and can be installed into a generation 2 virtual machine in Hyper-V. There is only one thing you need to know – Secure Boot has to be disabled. Hyper-V enables secure boot by default so if you just click through the wizard to create a VM it will not work. You have to disable Secure Boot.

Here’s the PowerShell way to check if Secure Boot is enable for your VMs:

Get-VM | Get-VMFirmware

To disable Secure Boot for a specific VM (‘TrustyTahr’) use this:

Get-VM -Name 'TrustyTahr' | Set-VMFirmware -EnableSecureBoot Off

Now you can install Ubuntu in a generation 2 Hyper-V machine. It just works. And even though I have not done any valid tests the gen 2 Ubuntu machine feels a lot snappier than on old one.

PowerShell loves enumerations

One of the things that make PowerShell oh-so-great is its tight integration with .NET Framework. As a simple example, in the framework there are many pre-define values, often stored as enumerated types. Enums are great because they allow us to define a set of values and then let the user (or program) choose among these values.

Another great thing with PowerShell is that it makes command arguments ‘pickable’ on the command line. So if I’m running a command and I am unsure of which arguments can be used I can simply press tab and I will se the first valid parameter value.
Let me show you the simple beauty of Enums together with PowerShell scripts.

function Get-SpecialFolderPath
  param ( [System.Environment+SpecialFolder]$SpecialFolder )
  return [System.Environment]::GetFolderPath($SpecialFolder)

This function takes one argument, the alias of a special folder, and returns the physical location of the special folder. The special folders that Windows knows about are define in the enumeration Environment.SpecialFolder. You can use the function like this:

Get-SpecialFolderPath -SpecialFolder Cookies

This in itself may not impress you (me neither:-)). But when you use this function toghether with your own function or other PowerShell cmdlets it becomes a great help for the user. Let’s say you want to quickly check what is in the users Cookie folder. How would you know where the cookies are stored? With this function you don’t, it is enough to type:

Get-SpecialFolderPath *tab*

As this is a static blogpost I can’t show you what happens when I press the <tab> key. but what does happen is that you will get the first value in the SpecialFolder enumeration, “Admintools”. Press tab again and you’ll get the second value which is “ApplicationData”. Another press of the tab key gies you “CDBurning” and so on.  You can of course avoid pressing tab many times by providing part of the name of the folder your are looking for:

Get-SpecialFolderPath coo *tab*

When you press tab this will expand to:

Get-SpecialFolderPath Cookies

A more relevant example: If you want to list all items on the users desktop you can combine Get-ChildItem with Get-SpecialFolder as this:

Get-ChildItem (Get-SpecialFolderPath Desktop)

This will give you a listing of all items in your dekstop folder. Again, the beauty is that you do not need to know the exact path to the Desktop folder.

Using enumerations to get input can really make your PowerShell scripts a lot easier to use and safer. So I hope you take some time to play around with using enumerations with your functions and cmdlets!

$env:HOME doesn’t work in PowerShell $PROFILE

Today I wanted to setup my PowerShell $PROFILE to make it easier to work with all the modules I learned about at the PowerShell Summit. I wanted to add an additional path to the environment variable $PSModulePath. Something that should be a picece of cake.

I store additional modules in the folder ‘Documents\WindowsPowerShell\Modules’ under my userdirectory (C:\Users\Joakim). So simply joining the path using Join-Path and add the result to $ENV:PSModulePath should do the trick:

$env:PSModulePath += ';'+ (Join-Path -Path ${env:HOME} -ChildPath 'Documents\WindowsPowerShell\Modules')

Unfortunately that didn’t work. And it confused me. Executing this on the PowerShell commandline worked fine, but when I put the line above in my $PROFILE it gave me this error:

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Joakim\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:3 char:44
+ $env:PSModulePath += ';'+ (Join-Path -Path ${env:HOME} -ChildPath 'Do ...
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

I understand what the error says and apparently the environment variable HOME is not instantiated when the $PROFILE is executed. This really confuses me. I already have the following line in my profile and it workes like a charm:


So environment variables are available when $PROFILE is executing… After a bit of frustration I changed from using


to using


and then it works!

So a word of advise if you want to find the users homedirectory when in the context of $PROFILE. Do not use $env:HOME

If anyone can explan when the HOME variable is instatiated vs the USERPROFILE… I’m listening 😉