■ Hyper-V 서비스를 사용하는 방법을 보여준다.
▶ 실행 명령
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$DisplayName = 'Hyper-V 가상 컴퓨터 관리' $HostName = 'kingdom' $Service = Get-Service -DisplayName $DisplayName -ErrorAction SilentlyContinue if(-not $Service) { $DisplayName + '는' + $HostName + '에 설치되지 않습니다.' Write-Host 'Hyper-V 서비스를 설치합니다.' Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All } elseif($Service.Status -eq "Running") { $DisplayName + '가 실행중입니다.' } else { $DisplayName + '가 중지되어 있습니다.' Start-Service -Name $Service.Name } |