change filenames, centralize logic in Invoke-WPFOOSU

This commit is contained in:
Marterich
2024-04-13 15:37:04 +02:00
parent da75194381
commit 3f39c61cb0
5 changed files with 55 additions and 11 deletions

View File

@ -2234,7 +2234,7 @@
"
]
},
"WPFTweaksOO": {
"WPFTweaksOOSU": {
"Content": "Run OO Shutup",
"Description": "Runs OO Shutup and applies the recommended Tweaks. https://www.oo-software.com/en/shutup10",
"category": "Essential Tweaks",
@ -2242,17 +2242,10 @@
"Order": "a002_",
"ToolTip": "Runs OO Shutup and applies the recommended Tweaks https://www.oo-software.com/en/shutup10",
"InvokeScript": [
"curl.exe -s \"https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/config/recommended_ooshutup10.cfg\" -o $ENV:temp\\recommended_ooshutup10.cfg
curl.exe -s \"https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe\" -o $ENV:temp\\OOSU10.exe
Start-Process $ENV:temp\\OOSU10.exe -ArgumentList \"\"\"$ENV:temp\\recommended_ooshutup10.cfg\"\" /quiet\"
Write-Host \"To modify the applied policies run $ENV:temp\\OOSU10.exe manually\" -ForegroundColor Yellow
"
"Invoke-WPFOOSU -action \"recommended\""
],
"UndoScript": [
"curl.exe -s \"https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/config/factory_ooshutup10.cfg\" -o $ENV:temp\\factory_ooshutup10.cfg
curl.exe -s \"https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe\" -o $ENV:temp\\OOSU10.exe
Start-Process $ENV:temp\\OOSU10.exe -ArgumentList \"\"\"$ENV:temp\\factory_ooshutup10.cfg\"\" /quiet\"
"
"Invoke-WPFOOSU -action \"undo\""
]
},
"WPFTweaksStorage": {
@ -2619,6 +2612,13 @@
"Order": "a067_",
"Type": "Toggle"
},
"WPFOOSUbutton": {
"Content": "Customize OO Shutup Tweaks",
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"Order": "a039_",
"Type": "220"
},
"WPFchangedns": {
"Content": "DNS",
"category": "z__Advanced Tweaks - CAUTION",
@ -2640,7 +2640,7 @@
"panel": "1",
"Order": "a042_",
"Type": "160"
},
},
"WPFAddUltPerf": {
"Content": "Add and Activate Ultimate Performance Profile",
"category": "Performance Plans",

View File

@ -27,6 +27,7 @@ function Invoke-WPFButton {
"WPFclear" {Invoke-WPFPresets -preset $null -imported $true}
"WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "WPFInstall"}
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
"WPFOOSUbutton" {Invoke-WPFOOSU -action "customize"}
"WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enabled"}
"WPFRemoveUltPerf" {Invoke-WPFUltimatePerformance -State "Disabled"}
"WPFundoall" {Invoke-WPFundoall}

View File

@ -0,0 +1,43 @@
function Invoke-WPFOOSU {
<#
.SYNOPSIS
Downloads and runs OO Shutup 10 with or without config files
.PARAMETER action
Specifies how OOSU should be started
customize: Opens the OOSU GUI
recommended: Loads and applies the recommended OOSU policies silently
undo: Resets all policies to factory silently
#>
param (
[ValidateSet("customize", "recommended", "undo")]
[string]$action
)
$OOSU_filepath = "$ENV:temp\OOSU10.exe"
$Initial_ProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue" # Disables the Progress Bar to drasticly speed up Invoke-WebRequest
Invoke-WebRequest -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -OutFile $OOSU_filepath
switch ($action)
{
"customize"{
Write-Host "Starting OO Shutup 10 ..."
Start-Process $OOSU_filepath
}
"recommended"{
$oosu_config = "$ENV:temp\ooshutup10_recommended.cfg"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Marterich/winutil/main/config/recommended_ooshutup10.cfg" -OutFile $oosu_config
Write-Host "Applying recommended OO Shutup 10 Policies"
Start-Process $OOSU_filepath -ArgumentList "$oosu_config /quiet"
}
"undo"{
$oosu_config = "$ENV:temp\ooshutup10_factory.cfg"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Marterich/winutil/main/config/factory_ooshutup10.cfg" -OutFile $oosu_config
Write-Host "Resetting all OO Shutup 10 Policies"
Start-Process $OOSU_filepath -ArgumentList "$oosu_config /quiet"
}
}
$ProgressPreference = $Initial_ProgressPreference
}