Files
loc_az_hci/infrastructure/router-server/install-hyper-v-host.ps1
defiQUG c39465c2bd
Some checks failed
Test / test (push) Has been cancelled
Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 09:04:46 -08:00

25 lines
916 B
PowerShell

# Install Hyper-V Host Role
$ErrorActionPreference = "Stop"
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host "Hyper-V Host Role Installation" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan
# Check if running as Administrator
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "This script requires Administrator privileges." -ForegroundColor Red
exit 1
}
Write-Host "`nInstalling Hyper-V role..." -ForegroundColor Yellow
try {
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
Write-Host "Hyper-V installed successfully. System will restart." -ForegroundColor Green
}
catch {
Write-Host "Error installing Hyper-V: $_" -ForegroundColor Red
exit 1
}