Created
December 17, 2015 11:56
-
-
Save DeploymentBunny/29e88f85cbb5f78b04b6 to your computer and use it in GitHub Desktop.
Chnage PowerShell Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check Build Version | |
# Due to a minor bug in the Hyper-V module 2.0 we need to replace that with the old version when creating VM's that uses Add-VMDvdDrive | |
if($PSVersionTable.BuildVersion.Major -eq 10){ | |
Write-Output "Note: Running on $($PSVersionTable.BuildVersion) and therefore we need to change to Hyper-V module 1.1" | |
Write-Output "Unloading Hyper-V module 2.0 and loading Hyper-V module 1.1" | |
Remove-Module Hyper-V -Force | |
Import-Module Hyper-v -RequiredVersion 1.1 -Force | |
Get-Module -Name Hyper-V | |
} | |
if($PSVersionTable.BuildVersion.Major -eq 10){ | |
Write-Output "Note: Running on $($PSVersionTable.BuildVersion) and therefore we need to change back to Hyper-V module 2.0" | |
Write-Output "Unloading Hyper-V module 1.1 and loading Hyper-V module 2.0" | |
Remove-Module Hyper-V -Force | |
Import-Module Hyper-v | |
Get-Module -Name Hyper-V | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment