install-virt-wsl-and-podman-desktop.ps1
· 1.3 KiB · PowerShell
Sin formato
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "CRITICAL ERROR: Please run this PowerShell window as Administrator." -ForegroundColor Red
exit
}
winget install Microsoft.PowerShell --silent --accept-package-agreements --accept-source-agreements
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Write-Host "--- Starting Technician Environment Setup ---" -ForegroundColor Cyan
Write-Host "[1/5] Enabling Hyper-V and Virtualization Features..." -ForegroundColor Yellow
$features = @(
"Microsoft-Hyper-V",
"Microsoft-Hyper-V-Management-Clients",
"Microsoft-Hyper-V-All",
"Microsoft-Windows-Subsystem-Linux",
"VirtualMachinePlatform"
)
foreach ($feature in $features) {
Write-Host "Installing: $feature"
dism.exe /online /enable-feature /featurename:$feature /all /norestart
}
wsl --update
wsl --set-default-version 2
wsl --update
winget install RedHat.Podman --silent --accept-package-agreements --accept-source-agreements
choco install podman-desktop -y
| 1 | if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { |
| 2 | Write-Host "CRITICAL ERROR: Please run this PowerShell window as Administrator." -ForegroundColor Red |
| 3 | exit |
| 4 | } |
| 5 | |
| 6 | winget install Microsoft.PowerShell --silent --accept-package-agreements --accept-source-agreements |
| 7 | |
| 8 | Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) |
| 9 | |
| 10 | |
| 11 | Write-Host "--- Starting Technician Environment Setup ---" -ForegroundColor Cyan |
| 12 | |
| 13 | Write-Host "[1/5] Enabling Hyper-V and Virtualization Features..." -ForegroundColor Yellow |
| 14 | $features = @( |
| 15 | "Microsoft-Hyper-V", |
| 16 | "Microsoft-Hyper-V-Management-Clients", |
| 17 | "Microsoft-Hyper-V-All", |
| 18 | "Microsoft-Windows-Subsystem-Linux", |
| 19 | "VirtualMachinePlatform" |
| 20 | ) |
| 21 | |
| 22 | foreach ($feature in $features) { |
| 23 | Write-Host "Installing: $feature" |
| 24 | dism.exe /online /enable-feature /featurename:$feature /all /norestart |
| 25 | } |
| 26 | |
| 27 | wsl --update |
| 28 | |
| 29 | wsl --set-default-version 2 |
| 30 | |
| 31 | wsl --update |
| 32 | |
| 33 | winget install RedHat.Podman --silent --accept-package-agreements --accept-source-agreements |
| 34 | |
| 35 | choco install podman-desktop -y |