## NOT TESTED ## #Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe #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() { 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 } } } function Update-Profile { if (-not (Test-Path $PROFILE)) { $null = New-Item -Force $PROFILE } if (-not (Test-Path ./CopyFromFile.txt)) {iex ((New-Object System.Net.WebClient).DownloadString('https://git.theflyingfool.com/theflyingfool/Win_Setup/raw/branch/main/CopyFromFile.txt'))} # Get-Content -Path $PROFILE Get-Content -Path .\CopyFromFile.txt | Add-Content -Path $PROFILE # Get-Content -Path $PROFILE #> <# Write-Output ' Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() $Local:word = $wordToComplete.Replace('"', '""') $Local:ast = $commandAst.ToString().Replace('"', '""') winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } }' >> $PROFILE #> } 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)' $ok =$answer -in @(1..5; 9) } until ($ok) 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.GoogleDrive' }, @{name = 'Hugo.Hugo.Extended' }, @{name = 'Bitwarden.Bitwarden' }, @{name = 'Sinew.Enpass'}, # Temp until everything moved to bitwarden @{name = 'Plex.Plex' }, @{name = 'Microsoft.MouseWithoutBorders'}, @{name = 'Vivaldi.Vivaldi' }, @{name = 'VideoLAN.VLC' }, @{name = 'PointPlanck.FileBot' }, @{name = 'Oracle.VirtualBox' }, @{name = 'NordSecurity.NordVPN' }, # @{name = 'Facebook.Messenger' }, # Cant find via winget anymore? @{name = 'Microsoft.Office' }, @{name = 'Malwarebytes.Malwarebytes '} ) InstallTheApps $Apps Update-Profile } "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" { $apps = @( ## 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' )