LabBuilder
LabBuilder copied to clipboard
Install-Lab doesn't detect if Hyper-V is missing
•PowerShell 5.1 •PowerShell Console as Administrator •Windows 10 b18362 •LabBuilder v1.0.4.84
If Install-Lab is run before Hyper-V has been setup, it will fail.
A suggestion is to check for Hyper-V and ask to set it up if it's missing.
This should do the trick
$InstallHyperV = Get-WindowsOptionalFeature -Online -FeatureName 'Microsoft-Hyper-V*' |
where State -ne 'Enabled' |
Enable-WindowsOptionalFeature -Online -NoRestart
If ($InstallHyperV.RestartNeeded){
Write-Host 'Computer needs to be restarted to activate Hyper-V'
Exit
}#end check restart