#Install WinGet ## WinGet should be on any windows 11 install by default $hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller' if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") { "Installing winget Dependencies" Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' $releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $releases = Invoke-RestMethod -uri $releases_url $latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Select-Object -First 1 "Installing winget from $($latestRelease.browser_download_url)" Add-AppxPackage -Path $latestRelease.browser_download_url } else { "winget already installed" } #Configure WinGet Write-Output "Configuring winget" #winget config path from: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md#file-location $settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json"; $settingsJson = @{installBehavior = @{ preferences = @{ scope = 'machine' } } } $settingsJson | ConvertTo-Json | Out-File $settingsPath -Encoding utf8 function InstallTheApps([array]$AppList) { Foreach ($app in $apps) { $listApp = winget list --exact -q $app.name if (![String]::Join('', $listApp).Contains($app.name)) { Write-Host 'Installing:' $app.name if ($null -ne $app.source) { winget install --exact $app.name --source $app.source # winget install --exact --silent $app.name --source $app.source } else { winget install --exact $app.name # winget install --exact --silent $app.name } } else { Write-Host 'Skipping Install of ' $app.name } } } do { $answer = $null do { if ( $answer) { Write-Host 'Invalid selection' Start-Sleep 2 Write-Host '' } Write-Host '1 - Base Apps' Write-Host '2 - Game Launchers' Write-Host '3 - Desktop only' Write-Host '4 - Lenovo Laptop only' Write-Host '5 - Remove Crap' Write-Host '9 - Exit' Write-Host '' $answer = Read-Host 'Select number(s)' } until ($answer -in @(1..5; 9)) if ($answer -eq 9) { break } switch ( $answer ) { '1' { $apps = @( # BASE APPS @{name = 'Microsoft.PowerShell' }, @{name = 'Microsoft.VisualStudioCode' }, @{name = 'Microsoft.WindowsTerminal'}, @{name = 'Microsoft.PowerToys' }, @{name = 'Git.Git' }, @{name = 'Google.Chrome' }, @{name = 'TorProject.TorBrowser'}, @{name = 'Google.Drive' }, @{name = 'Hugo.Hugo.Extended' }, @{name = 'Bitwarden.Bitwarden' }, @{name = 'Sinew.Enpass'}, # Temp until everything moved to bitwarden @{name = 'Plex.Plex' }, @{name = 'Microsoft.MouseWithoutBorders'}, @{name = 'VivaldiTechnologies.Vivaldi' }, @{name = 'VideoLAN.VLC' }, @{name = 'PointPlanck.FileBot' }, @{name = 'Oracle.VirtualBox' }, @{name = 'NordVPN.NordVPN' }, @{name = 'Facebook.Messenger' }, @{name = 'Microsoft.Office' }, @{name = 'Malwarebytes.Malwarebytes '} ) InstallTheApps $Apps } '2' { $apps = @( # Game Launchers @{name = 'ElectronicArts.EADesktop' }, @{name = 'Valve.Steam' }, @{name = 'EpicGames.EpicGamesLauncher' }, @{name = 'GOG.Galaxy '}, @{name = 'Discord.Discord '} ) InstallTheApps $Apps } '3' { $apps = @( ## DESKTOP @{name = 'SteelSeries.SteelSeriesEngine' }, @{name = 'Corsair.iCUE.5' }, @{name = 'Asus.ArmouryCrate '}, @{name = 'Nvidia.GeForceExperience '} ) InstallTheApps $Apps } '4' { $AppList = @( ## LAPTOP @{name = 'Intel.IntelDriverAndSupportAssistant' }, @{name = '9WZDNCRFJ4MV'; source = 'msstore' }, # Lenovo Vantage from MS Store @{name = 'j5create.Driver-JUA365' } ## Not sure if this is correct yet! ) InstallTheApps $Apps } '5' { ## REMOVE CRAP Write-Output 'Removing Apps' $apps = '*3DPrint*', 'Microsoft.MixedReality.Portal', 'Disney.*' , 'Microsoft.BingNews*' , '*BingWeather*', '*.MicrosoftOfficeHub*' , '*MicrosoftSolitaireCollection*' Foreach ($app in $apps) { Write-Host 'Uninstalling:' $app Get-AppxPackage -allusers $app | Remove-AppxPackage } } } } until ( $answer -eq '9' )