diff --git a/README.md b/README.md index cfe2da4c..dfeb291a 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,23 @@ irm "https://christitus.com/win" | iex irm "https://christitus.com/windev" | iex ``` +### Automation + +Winutil also supports predefined presets that apply common configurations automatically: + +- `Standard` +- `Minimal` +- `Advanced` + +Example: + +```powershell +& ([ScriptBlock]::Create((irm "https://christitus.com/win"))) -Preset Standard +``` + +To view exactly what each preset does, see: +https://github.com/ChrisTitusTech/winutil/blob/main/config/preset.json + If you have Issues, refer to [Known Issues](https://winutil.christitus.com/knownissues/) or [Create Issue](https://github.com/ChrisTitusTech/winutil/issues) ## 🎓 Documentation diff --git a/docs/content/userguide/automation/_index.md b/docs/content/userguide/automation/_index.md index 5c9b8faf..2c91c652 100644 --- a/docs/content/userguide/automation/_index.md +++ b/docs/content/userguide/automation/_index.md @@ -7,7 +7,22 @@ next: /userguide/win11creator/ Use Automation to run Winutil from an exported configuration file. -To create a config file: +Winutil supports predefined presets that apply common configurations automatically: + +- `Standard` +- `Minimal` +- `Advanced` + +Example: + +```powershell +& ([ScriptBlock]::Create((irm "https://christitus.com/win"))) -Preset Standard +``` + +To view exactly what each preset does, see: +https://github.com/ChrisTitusTech/winutil/blob/main/config/preset.json + +To create you're own config file: 1. Open Winutil. 2. Click the gear icon in the top-right corner. diff --git a/scripts/main.ps1 b/scripts/main.ps1 index d6d3cf85..7ce79d0b 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -68,6 +68,23 @@ $sync.configs.applications.PSObject.Properties | ForEach-Object { Set-Preferences +if ($Preset) { + Show-CTTLogo + + # Selects the tweaks from $Preset varible + Update-WinUtilSelections -flatJson $sync.configs.preset.$Preset + + # Run tweaks that were selected by Update-WinUtilSelections + Invoke-WinUtilAutoRun + + # Cleanup and exit + $sync.runspace.Dispose() + $sync.runspace.Close() + [System.GC]::Collect() + Stop-Transcript + return +} + if ($PARAM_NOUI) { Show-CTTLogo if ($PARAM_CONFIG -and -not [string]::IsNullOrWhiteSpace($PARAM_CONFIG)) { diff --git a/scripts/start.ps1 b/scripts/start.ps1 index d2c83834..177f917f 100644 --- a/scripts/start.ps1 +++ b/scripts/start.ps1 @@ -8,6 +8,8 @@ param ( [string]$Config, + [ValidateSet("Standard", "Minimal", "Advanced")] + [string]$Preset, [switch]$Noui, [switch]$Offline )