- ###########################
- ##### Install Docker v1.1
- ###########################
- # Check if admin
- if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
- Write-Host "Start me as administrator!" -BackgroundColor Red
- [Environment]::Exit(1)
- }
- # Install Choco
- Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- # Check virtualization and SLAT
- $SLAT = (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions
- if ($SLAT) {
- Write-Host "SLAT Enabled: $SLAT. All good." -BackgroundColor Green -ForegroundColor White
- } else {
- Write-Host "SLAT Enabled: $SLAT. Please turn it on from your BIOS settings." -BackgroundColor Red -ForegroundColor White
- }
- $VFE = (GWMI Win32_Processor).VirtualizationFirmwareEnabled
- if ($VFE) {
- Write-Host "Virtualization Firmware Enabled: $VFE. All good." -BackgroundColor Green -ForegroundColor White
- } else {
- Write-Host "Virtualization Firmware Enabled: $VFE. Please turn it on from your BIOS settings." -BackgroundColor Red -ForegroundColor White
- }
- # Add bootmenu entry for NoHyper-V
- Write-Host "Adding boot menu entry..." -BackgroundColor Yellow -ForegroundColor Black
- $Output = cmd.exe /c "bcdedit /copy {current} /d ""Windows 10 No Hyper-V"""
- $Regex = [Regex]::new("(?<={)(.*)(?=})")
- $Match = $Regex.Match($Output)
- if($Match.Success)
- {
- $NewID = $Match.Value
- cmd.exe /c "bcdedit /set {$NewID} hypervisorlaunchtype off"
- }
- # Install features
- Write-Host "Installing Containers feature..." -BackgroundColor Yellow -ForegroundColor Black
- Enable-WindowsOptionalFeature -Online -FeatureName containers -All -NoRestart
- Write-Host "Installing Hyper-V feature..." -BackgroundColor Yellow -ForegroundColor Black
- Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
- # Install Docker Desktop
- Write-Host "Installing Docker..." -BackgroundColor Yellow -ForegroundColor Black
- choco install -y docker-desktop
- # Restart
- Write-Host "All done. Please restart your computer" -BackgroundColor Green
Последни пейстове