From 8ec2947c9432e929a088e7706e3d52f4649cd0e0 Mon Sep 17 00:00:00 2001 From: theflyingfool Date: Sun, 11 Feb 2024 18:04:29 -0600 Subject: [PATCH] Add setup.ps1 --- setup.ps1 | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 setup.ps1 diff --git a/setup.ps1 b/setup.ps1 new file mode 100644 index 0000000..65ad93b --- /dev/null +++ b/setup.ps1 @@ -0,0 +1,112 @@ +## First REAL Attempt, winget not found on fresh install checked store for updates +## Switched to Beta channel to start +## Still had to run winget search test as normal user +## Settings section missing closing bracket +## Ea launcher bad hash +## Office hash didnt match +## Unhide all taskbar +## In terminal select "PowerShell" instead of Windows PS +## Set Windows Terminal as default + + +#Found here: https://chrislayers.com/2021/08/01/scripting-winget/ +#Based on this gist: https://gist.github.com/Codebytes/29bf18015f6e93fca9421df73c6e512c +#Which was based on, this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901 + +# PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/Codebytes/29bf18015f6e93fca9421df73c6e512c/raw/'))" +# Runs original, to run this one... +# winget search test ## Original script maynot require this since it does some settings +# PowerShell -NoProfile -ExecutionPolicy Bypass C:\Users\Nick\Documents\test.ps1 + +#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 { $_.browser_download_url.EndsWith('msixbundle') } | Select -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 = +@" + { + // For documentation on these settings, see: https://aka.ms/winget-settings + "installBehavior": { + "preferences": { + "scope": "machine" + } + } +"@; +$settingsJson | Out-File $settingsPath -Encoding utf8 + +#Install New apps +Write-Output "Installing Apps" +$apps = @( + @{name = "Microsoft.PowerShell" }, + @{name = "Microsoft.VisualStudioCode" }, + @{name = "9WZDNCRFJ4MV"; source = "msstore" }, # Lenovo Vantage from MS Store + @{name = "Microsoft.PowerToys" }, + @{name = "Git.Git" }, + @{name = "Google.Chrome" }, + @{name = "Google.Drive"}, + @{name = "Sinew.Enpass" }, + @{name = "Valve.Steam" }, + @{name = "Plex.Plex" }, + @{name = "ElectronicArts.EADesktop" }, #failed hash check on first test + @{name = "Intel.IntelDriverAndSupportAssistant"}, + @{name = "EpicGames.EpicGamesLauncher" }, + @{name = "VivaldiTechnologies.Vivaldi" }, + @{name = "VideoLAN.VLC"}, + @{name = "PointPlanck.FileBot"}, + @{name = "Oracle.VirtualBox"}, + @{name = "NordVPN.NordVPN"}, + @{name = "Hashicorp.Vagrant"}, + @{name = "Microsoft.Office"}, #Failed hash check on first test + @{name = "Facebook.Messenger"} +# @{name = "SteelSeries.SteelSeriesEngine"}, ## Might want to link this to a second PS script? +# @{name = "Corsair.iCUE.4"} ## Might want to link this to a second PS script? +); +Foreach ($app in $apps) { + $listApp = winget list --exact -q $app.name + if (![String]::Join("", $listApp).Contains($app.name)) { + Write-host "Installing:" $app.name + if ($app.source -ne $null) { + 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 + } +} + +#Remove Apps -- This section seems to need to run in an admin console! +Write-Output "Removing Apps" + +$apps = "*3DPrint*", "Microsoft.MixedReality.Portal", "Disney.*" ,"Microsoft.BingNews*" ,"*BingWeather*", +"*.MicrosoftOfficeHub*" , "*MicrosoftSolitaireCollection*" , "Microsoft.OneDrive" +Foreach ($app in $apps) +{ + Write-host "Uninstalling:" $app + Get-AppxPackage -allusers $app | Remove-AppxPackage +}