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 | |
} | |