POWERSHELL 36
Install Docker (Windows) Guest on 14th March 2020 05:55:46 PM
  1. ###########################
  2. ##### Install Docker v1.1
  3. ###########################
  4.  
  5.  
  6. # Check if admin
  7. if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
  8.     Write-Host "Start me as administrator!" -BackgroundColor Red
  9.   [Environment]::Exit(1)
  10. }
  11.  
  12. # Install Choco
  13. 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'))
  14.  
  15. # Check virtualization and SLAT
  16. $SLAT = (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions
  17. if ($SLAT) {
  18.     Write-Host "SLAT Enabled: $SLAT. All good." -BackgroundColor Green -ForegroundColor White
  19. } else {
  20.     Write-Host "SLAT Enabled: $SLAT. Please turn it on from your BIOS settings." -BackgroundColor Red -ForegroundColor White
  21. }
  22. $VFE = (GWMI Win32_Processor).VirtualizationFirmwareEnabled
  23. if ($VFE) {
  24.     Write-Host "Virtualization Firmware Enabled: $VFE. All good." -BackgroundColor Green -ForegroundColor White
  25. } else {
  26.     Write-Host "Virtualization Firmware Enabled: $VFE. Please turn it on from your BIOS settings." -BackgroundColor Red -ForegroundColor White
  27. }
  28.  
  29.  
  30. # Add bootmenu entry for NoHyper-V
  31. Write-Host "Adding boot menu entry..." -BackgroundColor Yellow -ForegroundColor Black
  32. $Output = cmd.exe /c "bcdedit /copy {current} /d ""Windows 10 No Hyper-V"""          
  33. $Regex = [Regex]::new("(?<={)(.*)(?=})")          
  34. $Match = $Regex.Match($Output)          
  35. if($Match.Success)          
  36. {          
  37.     $NewID = $Match.Value
  38.     cmd.exe /c "bcdedit /set {$NewID} hypervisorlaunchtype off"      
  39. }
  40.  
  41.  
  42. # Install features
  43. Write-Host "Installing Containers feature..." -BackgroundColor Yellow -ForegroundColor Black
  44. Enable-WindowsOptionalFeature -Online -FeatureName containers -All -NoRestart
  45. Write-Host "Installing Hyper-V feature..." -BackgroundColor Yellow -ForegroundColor Black
  46. Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
  47.  
  48.  
  49. # Install Docker Desktop
  50. Write-Host "Installing Docker..." -BackgroundColor Yellow -ForegroundColor Black
  51. choco install -y docker-desktop
  52.  
  53.  
  54. # Restart
  55. Write-Host "All done. Please restart your computer" -BackgroundColor Green

RSO cPaste е място за публикуване на код или текст за по-лесно отстраняване на грешки.

Влез или се Регистрай за да редактираш, изтриваш или преглеждаш хронология на твоето публикувано съдържание

Необработен текст

Влез или се Регистрирай за да редактираш или задържиш това съдържание.