winutil/functions/public/Invoke-WPFOOSU
2024-05-09 21:05:04 -07:00

42 lines
1.6 KiB
Plaintext

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"{
New-Item -Path $ENV:temp\ooshutup10_recommended.cfg -ItemType File -Value $sync.configs.ooshutup10_recommended -Force
Write-Host "Applying recommended OO Shutup 10 Policies"
Start-Process $OOSU_filepath -ArgumentList "$oosu_config /quiet" -Wait
}
"undo"{
New-Item -Path $ENV:temp\ooshutup10_factory.cfg -ItemType File -Value $sync.configs.ooshutup10_factory -Force
Write-Host "Resetting all OO Shutup 10 Policies"
Start-Process $OOSU_filepath -ArgumentList "$oosu_config /quiet" -Wait
}
}
$ProgressPreference = $Initial_ProgressPreference
}