Add check if EnhancedSessionTransportType is supported by the current version of HyperV
This commit is contained in:
parent
740b1bcabe
commit
0867fbd9d8
@ -17,8 +17,14 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
Hyper-V\Set-VM -VM $VM -EnhancedSessionTransportType $Type
|
||||
# HyperV 1.1 (Windows Server 2012R2) crashes on this call. Vagrantfiles before 2.2.10 do break without skipping this.
|
||||
$present = Get-Command Hyper-V\Set-VM -ParameterName EnhancedSessionTransportType -ErrorAction SilentlyContinue
|
||||
if($present) {
|
||||
Hyper-V\Set-VM -VM $VM -EnhancedSessionTransportType $Type
|
||||
}else{
|
||||
Write-OutputMessage "This version of HyperV does not support EnhancedSessionTransportType, ignoring."
|
||||
}
|
||||
} catch {
|
||||
Write-ErrorMessage "Failed to assign EnhancedSessionTransportType to ${Type}: ${PSItem}"
|
||||
Write-ErrorMessage "Failed to assign EnhancedSessionTransportType to ${Type}:${PSItem}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user