-
-
Save rpbush/31a6fc7fa659e0ea2679b712f62a0b0c to your computer and use it in GitHub Desktop.
DevMachineSetup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install WinGet | |
| # Reference: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901 | |
| $packageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller' | |
| if (!$packageManager -or [version]$packageManager.Version -lt [version]"1.10.0.0") { | |
| Write-Output "Installing winget dependencies" | |
| try { | |
| Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' | |
| $releasesUrl = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest' | |
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
| $releases = Invoke-RestMethod -uri $releasesUrl | |
| $latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Select-Object -First 1 | |
| Write-Output "Installing winget from $($latestRelease.browser_download_url)" | |
| Add-AppxPackage -Path $latestRelease.browser_download_url | |
| } catch { | |
| Write-Error "Failed to install winget: $_" | |
| exit 1 | |
| } | |
| } else { | |
| Write-Output "winget is already installed" | |
| } | |
| # Configure WinGet | |
| Write-Output "Configuring winget" | |
| $settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json" | |
| $settings = @{ | |
| experimentalFeatures = @{ | |
| experimentalMSStore = $true | |
| } | |
| } | |
| $settings | ConvertTo-Json -Depth 3 | Out-File $settingsPath -Encoding utf8 | |
| # Function to install applications | |
| function Install-Apps { | |
| param ( | |
| [array]$apps | |
| ) | |
| foreach ($app in $apps) { | |
| try { | |
| $installedApp = winget list --exact -q $app.name --accept-source-agreements | |
| if (-not $installedApp -or -not [String]::Join("", $installedApp).Contains($app.name)) { | |
| Write-Output "Installing: $($app.name)" | |
| $installCommand = "winget install --exact --silent $($app.name) --accept-package-agreements" | |
| if ($app.source) { | |
| $installCommand += " --source $($app.source)" | |
| } | |
| Invoke-Expression $installCommand | |
| } else { | |
| Write-Output "Skipping installation of: $($app.name) (already installed)" | |
| } | |
| } catch { | |
| Write-Error "Failed to install $($app.name): $_" | |
| } | |
| } | |
| } | |
| # Install New Apps | |
| Write-Output "Installing Apps" | |
| $appsToInstall = @( | |
| @{name = "Microsoft.AzureCLI"}, | |
| @{name = "Microsoft.PowerShell"}, | |
| @{name = "Microsoft.VisualStudioCode"}, | |
| @{name = "Microsoft.WindowsTerminal"; source = "msstore"}, | |
| @{name = "Microsoft.Azure.StorageExplorer"}, | |
| @{name = "Microsoft.PowerToys"}, | |
| @{name = "Git.Git"}, | |
| @{name = "Docker.DockerDesktop"}, | |
| @{name = "Microsoft.DotNet.SDK.8"}, | |
| @{name = "Microsoft.PowerBI"}, | |
| @{name = "GitHub.cli"}, | |
| @{name = "Canonical.Ubuntu.2204"}, | |
| @{name = "GitHub.GitHubDesktop"}, | |
| @{name = "UbiquitiInc.IdentityDesktop"}, | |
| @{name = "Python.Python.3.10"}, | |
| @{name = "Node.js"}, | |
| @{name = "9NBDXK71NK08"}, # Placeholder for actual app name | |
| @{name = "OpenWhisperSystems.Signal.Beta"}, | |
| @{name = "9WZDNCRD29V9"}, # Placeholder for actual app name | |
| @{name = "Microsoft.Teams"}, | |
| @{name = "Microsoft.VisualStudio.2022.Professional"}, | |
| @{name = "Microsoft.WindowsAdminCenter"}, | |
| @{name = "9P6PMZTM93LR"}, # Placeholder for actual app name | |
| @{name = "Microsoft.PowerAutomateDesktop"}, | |
| @{name = "Valve.Steam"}, | |
| @{name = "Google.VPNByGoogleOne"}, | |
| @{name = "Google.GoogleDrive"}, | |
| @{name = "Google.EarthPro"}, | |
| @{name = "Google.Chrome"}, | |
| @{name = "DJI.DJIAssistant2.ForMavic"}, | |
| @{name = "Adobe.Acrobat.Reader.64-bit"}, | |
| @{name = "XPDLPKWG9SW2WD"}, # Placeholder for actual app name | |
| @{name = "Garmin.Express"}, | |
| @{name = "Garmin.BaseCamp"}, | |
| @{name = "7zip.7zip"}, | |
| @{name = "Intel.WiFiDrivers"}, | |
| @{name = "Intel.IntelDriverAndSupportAssistant"}, | |
| @{name = "Notepad++.Notepad++"}, | |
| @{name = "Telegram.TelegramDesktop.Beta"} | |
| ) | |
| Install-Apps -apps $appsToInstall | |
| # Function to remove applications | |
| function Remove-Apps { | |
| param ( | |
| [array]$apps | |
| ) | |
| foreach ($app in $apps) { | |
| Write-Output "Uninstalling: $app" | |
| try { | |
| Get-AppxPackage -AllUsers -Name $app | Remove-AppxPackage | |
| } catch { | |
| Write-Error "Failed to uninstall $app: $_" | |
| } | |
| } | |
| } | |
| # Remove Unwanted Apps | |
| Write-Output "Removing Unwanted Apps" | |
| $appsToRemove = @("*3DPrint*", "Microsoft.MixedReality.Portal") | |
| Remove-Apps -apps $appsToRemove | |
| # Setup WSL | |
| Write-Output "Setting up WSL" | |
| try { | |
| wsl --install | |
| } catch { | |
| Write-Error "Failed to install WSL: $_" | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy and paste the below into PowerShell opened with administrator privileges.
iex ((New-Object System.Net.WebClient).DownloadString('https://gist.github.com/rpbush/31a6fc7fa659e0ea2679b712f62a0b0c/raw/0c6cffd96281c773ca5ea67761fa2271429faae1/DevMachineSetup.ps1'))