Win_Setup/setup.ps1

141 lines
5.1 KiB
PowerShell
Raw Normal View History

2024-02-11 18:04:29 -06:00
#Install WinGet
## WinGet should be on any windows 11 install by default
2024-05-13 14:25:39 -05:00
$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"
}
2024-02-11 18:04:29 -06:00
#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";
2024-05-13 14:25:39 -05:00
$settingsJson = @{installBehavior = @{
preferences = @{
scope = 'machine'
}
}
}
$settingsJson | ConvertTo-Json | Out-File $settingsPath -Encoding utf8
2024-05-12 22:54:46 -05:00
2024-05-13 16:31:39 -05:00
function InstallTheApps() {
Foreach ($app in $apps) {
2024-05-13 16:20:12 -05:00
$listApp = winget list --exact -q $app.name
2024-05-13 16:31:39 -05:00
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
2024-05-13 16:20:12 -05:00
}
else {
2024-05-13 16:31:39 -05:00
winget install --exact $app.name
# winget install --exact --silent $app.name
}
}
else {
Write-host "Skipping Install of " $app.name
2024-05-13 16:20:12 -05:00
}
}
}
2024-05-13 14:25:39 -05:00
do {
$answer = $null
do {
2024-05-12 22:54:46 -05:00
2024-05-13 14:25:39 -05:00
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))
2024-05-12 22:54:46 -05:00
2024-05-13 14:25:39 -05:00
if ($answer -eq 9) { break }
2024-05-12 22:54:46 -05:00
2024-05-13 16:20:12 -05:00
2024-05-12 22:54:46 -05:00
2024-05-13 14:25:39 -05:00
switch ( $answer ) {
'1' {
$apps = @( # BASE APPS
@{name = 'Microsoft.PowerShell' },
@{name = 'Microsoft.VisualStudioCode' },
2024-05-13 14:57:51 -05:00
@{name = 'Microsoft.WindowsTerminal'},
2024-05-13 14:25:39 -05:00
@{name = 'Microsoft.PowerToys' },
@{name = 'Git.Git' },
@{name = 'Google.Chrome' },
2024-05-13 15:17:46 -05:00
@{name = 'TorProject.TorBrowser'},
2024-05-13 14:25:39 -05:00
@{name = 'Google.Drive' },
@{name = 'Hugo.Hugo.Extended' },
@{name = 'Bitwarden.Bitwarden' },
2024-05-13 14:57:51 -05:00
@{name = 'Sinew.Enpass'}, # Temp until everything moved to bitwarden
2024-05-13 14:25:39 -05:00
@{name = 'Plex.Plex' },
2024-05-13 14:57:51 -05:00
@{name = 'Microsoft.MouseWithoutBorders'},
2024-05-13 14:25:39 -05:00
@{name = 'VivaldiTechnologies.Vivaldi' },
@{name = 'VideoLAN.VLC' },
@{name = 'PointPlanck.FileBot' },
@{name = 'Oracle.VirtualBox' },
@{name = 'NordVPN.NordVPN' },
@{name = 'Facebook.Messenger' },
2024-05-13 14:57:51 -05:00
@{name = 'Microsoft.Office' },
@{name = 'Malwarebytes.Malwarebytes '}
2024-05-13 14:25:39 -05:00
)
InstallTheApps $Apps
}
'2' {
$apps = @( # Game Launchers
@{name = 'ElectronicArts.EADesktop' },
@{name = 'Valve.Steam' },
2024-05-13 14:57:51 -05:00
@{name = 'EpicGames.EpicGamesLauncher' },
@{name = 'GOG.Galaxy '},
@{name = 'Discord.Discord '}
2024-05-13 14:25:39 -05:00
)
InstallTheApps $Apps
}
'3' {
$apps = @( ## DESKTOP
@{name = 'SteelSeries.SteelSeriesEngine' },
2024-05-13 14:57:51 -05:00
@{name = 'Corsair.iCUE.5' },
@{name = 'Asus.ArmouryCrate '},
@{name = 'Nvidia.GeForceExperience '}
2024-05-13 14:25:39 -05:00
)
InstallTheApps $Apps
}
'4' {
2024-05-13 16:32:26 -05:00
$apps = @( ## LAPTOP
2024-05-13 14:25:39 -05:00
@{name = 'Intel.IntelDriverAndSupportAssistant' },
2024-05-13 14:57:51 -05:00
@{name = '9WZDNCRFJ4MV'; source = 'msstore' }, # Lenovo Vantage from MS Store
@{name = 'j5create.Driver-JUA365' } ## Not sure if this is correct yet!
)
2024-05-12 22:54:46 -05:00
2024-05-13 14:25:39 -05:00
InstallTheApps $Apps
2024-05-12 22:54:46 -05:00
}
2024-05-13 14:25:39 -05:00
'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
2024-05-12 22:54:46 -05:00
}
}
}
2024-05-13 14:25:39 -05:00
} until ( $answer -eq '9' )