Use Get-EnvironmentVariable method

Changed how the environment variable for the chocolatey install
directory was retrieved. Using the $env: syntax won't find an
environment variable that was just added, it only pulls variables that
existed when the process was created. Calling the Get-EnvironmentVarible
method queries the registry directly.

This lets you install and use chocolatey without having to restart the
Octopus tentacle or the machine after the installation. This is also a
handy way to check environment variables that may have been created
after your process was spawned.