Skip to content

Instantly share code, notes, and snippets.

@bluntspoon
Last active March 12, 2024 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluntspoon/d3c73088b2d9fd33033a8e8cef2296e8 to your computer and use it in GitHub Desktop.
Save bluntspoon/d3c73088b2d9fd33033a8e8cef2296e8 to your computer and use it in GitHub Desktop.
Basic Dev Machine Setup using WinGet
#Install WinGet
Write-Host "-=Installing WinGet=-" -ForegroundColor Black -BackgroundColor White
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
Add-AppxPackage -Path 'https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
Write-Host "WinGet is installed" -ForegroundColor Green
}
else {
Write-Host "WinGet is already installed" -ForegroundColor Green
}
#Install Apps
Write-Host "-=Installing Apps=-" -ForegroundColor Black -BackgroundColor White
$apps = @(
@{id = "Microsoft.WindowsTerminal"}
@{id = "JanDeDobbeleer.OhMyPosh" }
@{id = "Microsoft.VisualStudioCode" }
@{id = "Microsoft.VisualStudio.2022.Professional" }
@{id = "Microsoft.AzureCLI" }
@{id = "Microsoft.AzureDataStudio" }
@{id = "Microsoft.AzureStorageExplorer" }
@{id = "Microsoft.PowerShell" }
@{id = "Microsoft.PowerToys" }
@{id = "Git.Git" }
@{id = "GitHub.cli" }
@{id = "Docker.DockerDesktop" }
@{id = "Microsoft.DotNet.SDK.6" }
@{id = "Microsoft.DotNet.SDK.8" }
);
Foreach ($app in $apps) {
$listApp = winget list --exact -q $app.id
if (![String]::Join("", $listApp).Contains($app.id)) {
Write-Host "Installing:" $app.id -ForegroundColor Green
if ($null -ne $app.source) {
winget install --exact --silent --id $app.id --source $app.source
}
else {
winget install --exact --silent --id $app.id
}
}
else {
Write-Host "Already Installed (will try upgrade): " $app.id -ForegroundColor Yellow
winget upgrade --silent --id $app.id
}
}
Write-Host "-=Installation & Upgrades Complete =-" -ForegroundColor Black -BackgroundColor White
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment