Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install-Lab doesn't detect if Hyper-V is missing #337

Open
DennisL68 opened this issue Oct 30, 2019 · 1 comment
Open

Install-Lab doesn't detect if Hyper-V is missing #337

DennisL68 opened this issue Oct 30, 2019 · 1 comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@DennisL68
Copy link

•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.

@PlagueHO PlagueHO added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Nov 10, 2019
@DennisL68
Copy link
Author

DennisL68 commented Feb 12, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants