Massive rewrite
This commit is contained in:
parent
20f11f4b2c
commit
65c4cc75e7
272
setup.ps1
272
setup.ps1
@ -1,205 +1,127 @@
|
|||||||
## 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
|
#Install WinGet
|
||||||
## WinGet should be on any windows 11 install by default
|
## WinGet should be on any windows 11 install by default
|
||||||
#$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
|
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
|
||||||
#if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
|
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
|
||||||
# "Installing winget Dependencies"
|
"Installing winget Dependencies"
|
||||||
# Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
|
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'
|
||||||
# $releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
#
|
$releases = Invoke-RestMethod -uri $releases_url
|
||||||
# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
$latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Select-Object -First 1
|
||||||
# $releases = Invoke-RestMethod -uri $releases_url
|
"Installing winget from $($latestRelease.browser_download_url)"
|
||||||
# $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1
|
Add-AppxPackage -Path $latestRelease.browser_download_url
|
||||||
#
|
}
|
||||||
# "Installing winget from $($latestRelease.browser_download_url)"
|
else {
|
||||||
# Add-AppxPackage -Path $latestRelease.browser_download_url
|
"winget already installed"
|
||||||
#}
|
}
|
||||||
#else {
|
|
||||||
# "winget already installed"
|
|
||||||
#}
|
|
||||||
|
|
||||||
#Configure WinGet
|
#Configure WinGet
|
||||||
do {
|
|
||||||
do {
|
|
||||||
Clear-Host ## Clear screen?
|
|
||||||
Write-Output "Configuring winget"
|
Write-Output "Configuring winget"
|
||||||
|
|
||||||
#winget config path from: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md#file-location
|
#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";
|
$settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json";
|
||||||
$settingsJson =
|
$settingsJson = @{installBehavior = @{
|
||||||
@"
|
preferences = @{
|
||||||
{
|
scope = 'machine'
|
||||||
// For documentation on these settings, see: https://aka.ms/winget-settings
|
|
||||||
"installBehavior": {
|
|
||||||
"preferences": {
|
|
||||||
"scope": "machine"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"@;
|
}
|
||||||
$settingsJson | Out-File $settingsPath -Encoding utf8
|
$settingsJson | ConvertTo-Json | Out-File $settingsPath -Encoding utf8
|
||||||
|
|
||||||
write-host "1 - Base Apps"
|
do {
|
||||||
write-host "2 - Game Launchers"
|
$answer = $null
|
||||||
write-host "3 - Desktop only"
|
do {
|
||||||
write-host "4 - Lenovo Laptop only"
|
|
||||||
write-host "5 - Remove Crap"
|
|
||||||
|
|
||||||
write-host "9 - Exit"
|
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)'
|
||||||
|
|
||||||
write-host ""
|
} until ($answer -in @(1..5; 9))
|
||||||
$answer = read-host "Select number(s)"
|
|
||||||
|
|
||||||
$ok = $answer -match '[123459]+$'
|
if ($answer -eq 9) { break }
|
||||||
if ( -not $ok) {write-host "Invalid selection"
|
|
||||||
Start-Sleep 2
|
|
||||||
write-host ""
|
|
||||||
}
|
|
||||||
} until ($ok)
|
|
||||||
|
|
||||||
switch -Regex ( $answer ) {
|
function InstallTheApps([array]$AppList) {
|
||||||
"1" { $apps = @( # BASE APPS
|
Foreach ($app in $AppList) {
|
||||||
@{name = "Microsoft.PowerShell" },
|
|
||||||
@{name = "Microsoft.VisualStudioCode" },
|
|
||||||
@{name = "Microsoft.PowerToys" },
|
|
||||||
@{name = "Git.Git" },
|
|
||||||
@{name = "Google.Chrome" },
|
|
||||||
@{name = "Google.Drive"},
|
|
||||||
@{name = "Hugo.Hugo.Extended"},
|
|
||||||
@{name = "Bitwarden.Bitwarden"},
|
|
||||||
@{name = "Plex.Plex" },
|
|
||||||
@{name = "VivaldiTechnologies.Vivaldi" },
|
|
||||||
@{name = "VideoLAN.VLC"},
|
|
||||||
@{name = "PointPlanck.FileBot"},
|
|
||||||
@{name = "Oracle.VirtualBox"},
|
|
||||||
@{name = "NordVPN.NordVPN"},
|
|
||||||
@{name = "Facebook.Messenger"},
|
|
||||||
@{name = "Microsoft.Office"}
|
|
||||||
)
|
|
||||||
Foreach ($app in $apps) {
|
|
||||||
$listApp = winget list --exact -q $app.name
|
$listApp = winget list --exact -q $app.name
|
||||||
if (![String]::Join("", $listApp).Contains($app.name)) {
|
if (![String]::Join('', $listApp).Contains($app.name)) {
|
||||||
Write-host "Installing:" $app.name
|
Write-Host 'Installing:' $app.name
|
||||||
if ($null -ne $app.source) {
|
if ($null -ne $app.source) {
|
||||||
winget install --exact $app.name --source $app.source
|
winget install --exact $app.name --source $app.source
|
||||||
# winget install --exact --silent $app.name --source $app.source
|
# winget install --exact --silent $app.name --source $app.source
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
winget install --exact $app.name
|
winget install --exact $app.name
|
||||||
# winget install --exact --silent $app.name
|
# winget install --exact --silent $app.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-host "Skipping Install of " $app.name
|
Write-Host 'Skipping Install of ' $app.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"2" {
|
|
||||||
{ $apps = @( # Game Launchers
|
switch ( $answer ) {
|
||||||
@{name = "ElectronicArts.EADesktop" },
|
'1' {
|
||||||
@{name = "Valve.Steam" },
|
$apps = @( # BASE APPS
|
||||||
@{name = "EpicGames.EpicGamesLauncher" }
|
@{name = 'Microsoft.PowerShell' },
|
||||||
|
@{name = 'Microsoft.VisualStudioCode' },
|
||||||
|
@{name = 'Microsoft.PowerToys' },
|
||||||
|
@{name = 'Git.Git' },
|
||||||
|
@{name = 'Google.Chrome' },
|
||||||
|
@{name = 'Google.Drive' },
|
||||||
|
@{name = 'Hugo.Hugo.Extended' },
|
||||||
|
@{name = 'Bitwarden.Bitwarden' },
|
||||||
|
@{name = 'Plex.Plex' },
|
||||||
|
@{name = 'VivaldiTechnologies.Vivaldi' },
|
||||||
|
@{name = 'VideoLAN.VLC' },
|
||||||
|
@{name = 'PointPlanck.FileBot' },
|
||||||
|
@{name = 'Oracle.VirtualBox' },
|
||||||
|
@{name = 'NordVPN.NordVPN' },
|
||||||
|
@{name = 'Facebook.Messenger' },
|
||||||
|
@{name = 'Microsoft.Office' }
|
||||||
)
|
)
|
||||||
|
InstallTheApps $Apps
|
||||||
|
}
|
||||||
|
'2' {
|
||||||
|
$apps = @( # Game Launchers
|
||||||
|
@{name = 'ElectronicArts.EADesktop' },
|
||||||
|
@{name = 'Valve.Steam' },
|
||||||
|
@{name = 'EpicGames.EpicGamesLauncher' }
|
||||||
|
)
|
||||||
|
InstallTheApps $Apps
|
||||||
|
}
|
||||||
|
'3' {
|
||||||
|
$apps = @( ## DESKTOP
|
||||||
|
@{name = 'SteelSeries.SteelSeriesEngine' },
|
||||||
|
@{name = 'Corsair.iCUE.4' }
|
||||||
|
)
|
||||||
|
InstallTheApps $Apps
|
||||||
|
}
|
||||||
|
'4' {
|
||||||
|
$apps = @( ## LAPTOP
|
||||||
|
@{name = 'Intel.IntelDriverAndSupportAssistant' },
|
||||||
|
@{name = '9WZDNCRFJ4MV'; source = 'msstore' } # Lenovo Vantage from MS Store
|
||||||
|
)
|
||||||
|
|
||||||
|
InstallTheApps $Apps
|
||||||
|
}
|
||||||
|
'5' {
|
||||||
|
## REMOVE CRAP
|
||||||
|
Write-Output 'Removing Apps'
|
||||||
|
$apps = '*3DPrint*', 'Microsoft.MixedReality.Portal', 'Disney.*' , 'Microsoft.BingNews*' , '*BingWeather*', '*.MicrosoftOfficeHub*' , '*MicrosoftSolitaireCollection*'
|
||||||
Foreach ($app in $apps) {
|
Foreach ($app in $apps) {
|
||||||
$listApp = winget list --exact -q $app.name
|
Write-Host 'Uninstalling:' $app
|
||||||
if (![String]::Join("", $listApp).Contains($app.name)) {
|
Get-AppxPackage -allusers $app | Remove-AppxPackage
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
"3" {## DESKTOP
|
|
||||||
{ $apps = @(
|
|
||||||
@{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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} until ( $answer -eq '9' )
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
"4" {## LAPTOP
|
|
||||||
|
|
||||||
{ $apps = @(
|
|
||||||
@{name = "Intel.IntelDriverAndSupportAssistant"},
|
|
||||||
@{name = "9WZDNCRFJ4MV"; source = "msstore" } # Lenovo Vantage from MS Store
|
|
||||||
)
|
|
||||||
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
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
winget install --exact $app.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-host "Skipping Install of " $app.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"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 -match "9" )
|
|
||||||
|
Loading…
Reference in New Issue
Block a user