Files
winutil/scripts/start.ps1
Gabi 7c71a39f7a Feature/appx removal tab (#4729)
* feat: add config-driven AppX package removal tab

- Add config/appx.json with curated list of removable AppX packages

- Add AppX Removal tab (WPFTab6) with Select All, Clear, and Remove buttons

- Reuse existing Invoke-WPFUIElements engine for minimal code footprint

- Add Invoke-WPFAppxRemoval.ps1 for background runspace package removal

- Add theme colors for the new tab button in light and dark modes

* yep

* yep

* yep

* yep

* Update inputXML.xaml

* Update Invoke-WPFButton.ps1

* Update Invoke-WPFButton.ps1

* Update Invoke-WPFSelectedCheckboxesUpdate.ps1

* Update appx.json

* Update appx.json

* Update appx.json

* Update tweaks.json

* Update appx.json

* Update appx.json

* Update appx.json

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFButton.ps1

* Delete functions/public/Invoke-WPFAppxRemoval.ps1

* Revert "Update Invoke-WPFButton.ps1"

This reverts commit d8705cc08e.

* Revert "Delete functions/public/Invoke-WPFAppxRemoval.ps1"

This reverts commit 9e45d1ad99.

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFButton.ps1

* yep

* Update appx.json

* Update appx.json

* Update tweaks.json

* Update start.ps1

* Update preset.json

* Update tweaks.json

* yep

* yep

* yep

* yep

* yep

* yep

* Update Invoke-WPFAppxRemoval.ps1

* Update Update-WinUtilSelections.ps1

* Update Update-WinUtilSelections.ps1

* yep

* Update Invoke-WPFAppxRemoval.ps1

* yep

* yep

* Update Invoke-WPFAppxRemoval.ps1

* Update appx.json

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update appx.json

* Update Invoke-WPFGetInstalled.ps1

* Update Invoke-WPFAppxRemoval.ps1

* yep

* yep

* Update Invoke-WPFSelectedCheckboxesUpdate.ps1

* yep

* yep

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* yep

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update appx.json

* Update Invoke-WPFImpex.ps1

* Update Invoke-WPFImpex.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update preset.json

* Update preset.json

* Update Invoke-WPFSelectedCheckboxesUpdate.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update tweaks.json

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* Update Invoke-WPFAppxRemoval.ps1

* yep

* yep

* Update Invoke-WPFAppxRemoval.ps1

* yep

* Delete functions/private/Find-AppxByNameOrDescription.ps1

* yep

* Update Invoke-WPFButton.ps1

* Update main.ps1

* Update Invoke-WPFTab.ps1

* yep

* yep

* Update themes.json
2026-07-01 12:13:32 -05:00

92 lines
3.2 KiB
PowerShell

<#
.NOTES
Author : Chris Titus @christitustech
Runspace Author: @DeveloperDurp
GitHub : https://github.com/ChrisTitusTech
Version : #{replaceme}
#>
param (
[string]$Config,
[ValidateSet("Standard", "Minimal", "Advanced", "")]
[string]$Preset,
[switch]$Offline
)
$PARAM_OFFLINE = $false
if ($Offline) {
$PARAM_OFFLINE = $true
}
if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage') {
Write-Host "WinUtil is unable to run on your system. PowerShell execution is restricted by security policies." -ForegroundColor Red
return
}
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Output "WinUtil needs to be run as Administrator. Attempting to relaunch."
$argList = @()
$PSBoundParameters.GetEnumerator() | ForEach-Object {
$argList += if ($_.Value -is [switch] -and $_.Value) {
"-$($_.Key)"
} elseif ($_.Value -is [array]) {
"-$($_.Key) $($_.Value -join ',')"
} elseif ($_.Value) {
"-$($_.Key) '$($_.Value)'"
}
}
$script = if ($PSCommandPath) {
"& { & `'$($PSCommandPath)`' $($argList -join ' ') }"
} else {
"&([ScriptBlock]::Create((irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1))) $($argList -join ' ')"
}
$powershellCmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { "$powershellCmd" }
if ($processCmd -eq "wt.exe") {
Start-Process $processCmd -ArgumentList "$powershellCmd -ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs
} else {
Start-Process $processCmd -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs
}
break
}
# Load DLLs
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.Windows.Forms
# Variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot
$sync.version = "#{replaceme}"
$sync.configs = @{}
$sync.Buttons = [System.Collections.Generic.List[PSObject]]::new()
$sync.preferences = @{}
$sync.ProcessRunning = $false
$sync.selectedAppx = [System.Collections.Generic.List[string]]::new()
$sync.selectedApps = [System.Collections.Generic.List[string]]::new()
$sync.selectedTweaks = [System.Collections.Generic.List[string]]::new()
$sync.selectedToggles = [System.Collections.Generic.List[string]]::new()
$sync.selectedFeatures = [System.Collections.Generic.List[string]]::new()
$sync.currentTab = "Install"
$sync.selectedAppsStackPanel
$sync.selectedAppsPopup
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
# Set the path for the winutil directory
$winutildir = "$env:LocalAppData\winutil"
New-Item $winutildir -ItemType Directory -Force | Out-Null
$logdir = "$winutildir\logs"
New-Item $logdir -ItemType Directory -Force | Out-Null
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
# Set PowerShell window title
$Host.UI.RawUI.WindowTitle = "WinUtil (Admin)"
clear-host