diff --git a/config/factory_ooshutup10.cfg b/config/ooshutup10_factory.cfg similarity index 100% rename from config/factory_ooshutup10.cfg rename to config/ooshutup10_factory.cfg diff --git a/config/recommended_ooshutup10.cfg b/config/ooshutup10_recommended.cfg similarity index 100% rename from config/recommended_ooshutup10.cfg rename to config/ooshutup10_recommended.cfg diff --git a/config/tweaks.json b/config/tweaks.json index 7835a407..67542224 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -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", diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index 7fa8638a..e7baf092 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -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} diff --git a/functions/public/Invoke-WPFOOSU b/functions/public/Invoke-WPFOOSU new file mode 100644 index 00000000..805ff88a --- /dev/null +++ b/functions/public/Invoke-WPFOOSU @@ -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 +}