Skip to content

Instantly share code, notes, and snippets.

View markcowl's full-sized avatar

Mark Cowlishaw markcowl

View GitHub Profile
@markcowl
markcowl / gist:95324d3e68947dddf801
Last active August 29, 2015 14:02
Fix Windows Azure PowerShell PSModulePath (broken in 0.8.1, 0.8.2, 0.8.3)
In versions 0.8.1 - 0.8.3 of Windows Azure PowerShell, the installer prepended the value %PSModulePath% to the System environment variable for PSModulePath. This would cause some user-specific PowerShell scripts to be removed from the default path and to no longer be discoverable by default. The attached script fixes the issue. When run from an elevated command prompt it will clean up the machine-wide PSModulePath variable and the PSModulePath in the current session.
This is wrtten as a script. You must have ExecutionPolicy set to RemoteSigned or Unrestricted to run this script. It must be run from an elevated command prompt.
To execute, simply save the script to a ps1 file, like 'FixEnvironment.ps1' and run the script from the command line
> .\FixEnvironment.ps1
The script will prompt before making changes. You can control prompting using the standard parameters (e.g -Force)