mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-11 02:21:16 +10:00
Compare commits
8
Commits
e4d305284b
...
e50621a9dc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e50621a9dc | ||
|
|
3ef100a083 | ||
|
|
eebb56ac5a | ||
|
|
daf045390d | ||
|
|
6214012fd1 | ||
|
|
297b3079e5 | ||
|
|
9fdf944ef9 | ||
|
|
6b5a9bcb9b |
+4
-4
@@ -673,7 +673,7 @@
|
|||||||
icacls $Env:OneDrive /grant \"Administrators:(D,DC)\"
|
icacls $Env:OneDrive /grant \"Administrators:(D,DC)\"
|
||||||
|
|
||||||
if (-not (Get-ChildItem -Path $Env:OneDrive)) {
|
if (-not (Get-ChildItem -Path $Env:OneDrive)) {
|
||||||
Remove-Item -Path $Env:OneDrive
|
Remove-Item -Path $Env:OneDrive -Recurse
|
||||||
[Environment]::SetEnvironmentVariable('OneDrive', $null, 'User')
|
[Environment]::SetEnvironmentVariable('OneDrive', $null, 'User')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -970,7 +970,7 @@
|
|||||||
Remove-AppxPackage $Appx
|
Remove-AppxPackage $Appx
|
||||||
|
|
||||||
Set-Service -Name WSAIFabricSvc -StartupType Disabled
|
Set-Service -Name WSAIFabricSvc -StartupType Disabled
|
||||||
Disable-WindowsOptionalFeature -FeatureName Recall -Online
|
Disable-WindowsOptionalFeature -FeatureName Recall -Online -NoRestart
|
||||||
|
|
||||||
Write-Host \"Windows AI Disabled\"
|
Write-Host \"Windows AI Disabled\"
|
||||||
"
|
"
|
||||||
@@ -1775,9 +1775,9 @@
|
|||||||
{
|
{
|
||||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Search",
|
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Search",
|
||||||
"Name": "SearchboxTaskbarMode",
|
"Name": "SearchboxTaskbarMode",
|
||||||
"Value": "0",
|
"Value": "1",
|
||||||
"Type": "DWord",
|
"Type": "DWord",
|
||||||
"OriginalValue": "d",
|
"OriginalValue": "0",
|
||||||
"DefaultState": "true"
|
"DefaultState": "true"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ description: ""
|
|||||||
{
|
{
|
||||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Search",
|
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Search",
|
||||||
"Name": "SearchboxTaskbarMode",
|
"Name": "SearchboxTaskbarMode",
|
||||||
"Value": "0",
|
"Value": "1",
|
||||||
"Type": "DWord",
|
"Type": "DWord",
|
||||||
"OriginalValue": "d",
|
"OriginalValue": "0",
|
||||||
"DefaultState": "true"
|
"DefaultState": "true"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ description: ""
|
|||||||
icacls $Env:OneDrive /grant \"Administrators:(D,DC)\"
|
icacls $Env:OneDrive /grant \"Administrators:(D,DC)\"
|
||||||
|
|
||||||
if (-not (Get-ChildItem -Path $Env:OneDrive)) {
|
if (-not (Get-ChildItem -Path $Env:OneDrive)) {
|
||||||
Remove-Item -Path $Env:OneDrive
|
Remove-Item -Path $Env:OneDrive -Recurse
|
||||||
[Environment]::SetEnvironmentVariable('OneDrive', $null, 'User')
|
[Environment]::SetEnvironmentVariable('OneDrive', $null, 'User')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ description: ""
|
|||||||
Remove-AppxPackage $Appx
|
Remove-AppxPackage $Appx
|
||||||
|
|
||||||
Set-Service -Name WSAIFabricSvc -StartupType Disabled
|
Set-Service -Name WSAIFabricSvc -StartupType Disabled
|
||||||
Disable-WindowsOptionalFeature -FeatureName Recall -Online
|
Disable-WindowsOptionalFeature -FeatureName Recall -Online -NoRestart
|
||||||
|
|
||||||
Write-Host \"Windows AI Disabled\"
|
Write-Host \"Windows AI Disabled\"
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
[string]$SearchString = ""
|
[string]$SearchString = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
# 1. RESOLVE $SYNC WITH MULTI-LEVEL FALLBACK
|
# 1. RESOLVE $SYNC WITH MULTI-LEVEL FALLBACK
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
if ($null -eq $Sync) {
|
if ($null -eq $Sync) {
|
||||||
$Sync = $global:sync
|
$Sync = $global:sync
|
||||||
@@ -45,9 +45,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
# 2. GET REFERENCE TO TWEAKS PANEL
|
# 2. GET REFERENCE TO TWEAKS PANEL
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
$tweaksPanel = $null
|
$tweaksPanel = $null
|
||||||
try {
|
try {
|
||||||
@@ -63,9 +63,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
# 3. HANDLE EMPTY/WHITESPACE SEARCH STRING - RESET TO DEFAULT STATE
|
# 3. HANDLE EMPTY/WHITESPACE SEARCH STRING - RESET TO DEFAULT STATE
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($SearchString)) {
|
if ([string]::IsNullOrWhiteSpace($SearchString)) {
|
||||||
try {
|
try {
|
||||||
@@ -114,9 +114,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
# 4. PERFORM LITERAL SEARCH (NO WILDCARD EXPANSION)
|
# 4. PERFORM LITERAL SEARCH (NO WILDCARD EXPANSION)
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Normalize search term once for the entire operation
|
# Normalize search term once for the entire operation
|
||||||
@@ -151,9 +151,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
# Check if this is a category label (usually first Label)
|
# Check if this is a category label (usually first Label)
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
if ($item -is [Windows.Controls.Label]) {
|
if ($item -is [Windows.Controls.Label]) {
|
||||||
$categoryLabel = $item
|
$categoryLabel = $item
|
||||||
@@ -161,9 +161,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
$item.Visibility = [Windows.Visibility]::Collapsed
|
$item.Visibility = [Windows.Visibility]::Collapsed
|
||||||
}
|
}
|
||||||
|
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
# Check if this is a DockPanel containing a tweak checkbox
|
# Check if this is a DockPanel containing a tweak checkbox
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
elseif ($item -is [Windows.Controls.DockPanel]) {
|
elseif ($item -is [Windows.Controls.DockPanel]) {
|
||||||
$checkbox = $null
|
$checkbox = $null
|
||||||
@@ -211,9 +211,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
# Check if this is a StackPanel containing a tweak checkbox
|
# Check if this is a StackPanel containing a tweak checkbox
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
elseif ($item -is [Windows.Controls.StackPanel]) {
|
elseif ($item -is [Windows.Controls.StackPanel]) {
|
||||||
$checkbox = $null
|
$checkbox = $null
|
||||||
@@ -257,9 +257,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
# Update category label visibility and expanded/collapsed state
|
# Update category label visibility and expanded/collapsed state
|
||||||
# ────────────────────────────────────────────────────────────
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
if ($categoryHasMatch) {
|
if ($categoryHasMatch) {
|
||||||
# Show category label
|
# Show category label
|
||||||
@@ -282,9 +282,9 @@ function Find-TweaksByNameOrDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ────────────────────────────────────────────────────────────────
|
# ----------------------------------------------------------------
|
||||||
# Set category border visibility based on whether it has matches
|
# Set category border visibility based on whether it has matches
|
||||||
# ────────────────────────────────────────────────────────────────
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
if ($categoryHasMatch) {
|
if ($categoryHasMatch) {
|
||||||
$categoryBorder.Visibility = [Windows.Visibility]::Visible
|
$categoryBorder.Visibility = [Windows.Visibility]::Visible
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ function Invoke-WinUtilISOMountAndVerify {
|
|||||||
|
|
||||||
if (-not (Test-Path $wimPath) -and -not (Test-Path $esdPath)) {
|
if (-not (Test-Path $wimPath) -and -not (Test-Path $esdPath)) {
|
||||||
Dismount-DiskImage -ImagePath $isoPath
|
Dismount-DiskImage -ImagePath $isoPath
|
||||||
Write-Win11ISOLog "ERROR: install.wim/install.esd not found — not a valid Windows ISO."
|
Write-Win11ISOLog "ERROR: install.wim/install.esd not found - not a valid Windows ISO."
|
||||||
[System.Windows.MessageBox]::Show(
|
[System.Windows.MessageBox]::Show(
|
||||||
"This does not appear to be a valid Windows ISO.`n`ninstall.wim / install.esd was not found.",
|
"This does not appear to be a valid Windows ISO.`n`ninstall.wim / install.esd was not found.",
|
||||||
"Invalid ISO", "OK", "Error")
|
"Invalid ISO", "OK", "Error")
|
||||||
@@ -547,7 +547,7 @@ function Invoke-WinUtilISOCleanAndReset {
|
|||||||
Log "Temp directory deleted successfully."
|
Log "Temp directory deleted successfully."
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log "No temp directory found — resetting UI."
|
Log "No temp directory found - resetting UI."
|
||||||
}
|
}
|
||||||
|
|
||||||
SetProgress "Resetting UI..." 95
|
SetProgress "Resetting UI..." 95
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── 1. Remove provisioned AppX packages ──────────────────────────────────
|
# -- 1. Remove provisioned AppX packages ----------------------------------
|
||||||
& $Log "Removing provisioned AppX packages..."
|
& $Log "Removing provisioned AppX packages..."
|
||||||
|
|
||||||
$packages = & dism /English "/image:$ScratchDir" /Get-ProvisionedAppxPackages |
|
$packages = & dism /English "/image:$ScratchDir" /Get-ProvisionedAppxPackages |
|
||||||
@@ -139,7 +139,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
$packages | Where-Object { $pkg = $_; $packagePrefixes | Where-Object { $pkg -like "*$_*" } } |
|
$packages | Where-Object { $pkg = $_; $packagePrefixes | Where-Object { $pkg -like "*$_*" } } |
|
||||||
ForEach-Object { & dism /English "/image:$ScratchDir" /Remove-ProvisionedAppxPackage "/PackageName:$_" }
|
ForEach-Object { & dism /English "/image:$ScratchDir" /Remove-ProvisionedAppxPackage "/PackageName:$_" }
|
||||||
|
|
||||||
# ── 2. Inject current system drivers (optional) ───────────────────────────
|
# -- 2. Inject current system drivers (optional) ---------------------------
|
||||||
if ($InjectCurrentSystemDrivers) {
|
if ($InjectCurrentSystemDrivers) {
|
||||||
& $Log "Exporting all drivers from running system..."
|
& $Log "Exporting all drivers from running system..."
|
||||||
$driverExportRoot = Join-Path $env:TEMP "WinUtil_DriverExport_$(Get-Random)"
|
$driverExportRoot = Join-Path $env:TEMP "WinUtil_DriverExport_$(Get-Random)"
|
||||||
@@ -157,7 +157,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
& $Log "Injecting current system drivers into boot.wim..."
|
& $Log "Injecting current system drivers into boot.wim..."
|
||||||
Invoke-BootWimInject -BootWimPath $bootWim -DriverDir $driverExportRoot -Logger $Log
|
Invoke-BootWimInject -BootWimPath $bootWim -DriverDir $driverExportRoot -Logger $Log
|
||||||
} else {
|
} else {
|
||||||
& $Log "Warning: boot.wim not found — skipping boot.wim driver injection."
|
& $Log "Warning: boot.wim not found - skipping boot.wim driver injection."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -169,7 +169,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
& $Log "Driver injection skipped."
|
& $Log "Driver injection skipped."
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── 3. Registry tweaks ────────────────────────────────────────────────────
|
# -- 3. Registry tweaks ----------------------------------------------------
|
||||||
& $Log "Loading offline registry hives..."
|
& $Log "Loading offline registry hives..."
|
||||||
reg load HKLM\zCOMPONENTS "$ScratchDir\Windows\System32\config\COMPONENTS"
|
reg load HKLM\zCOMPONENTS "$ScratchDir\Windows\System32\config\COMPONENTS"
|
||||||
reg load HKLM\zDEFAULT "$ScratchDir\Windows\System32\config\default"
|
reg load HKLM\zDEFAULT "$ScratchDir\Windows\System32\config\default"
|
||||||
@@ -243,7 +243,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
& $Log "Pre-staged setup script: $relPath"
|
& $Log "Pre-staged setup script: $relPath"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
& $Log "Warning: no <Extensions><File> nodes found in autounattend.xml — setup scripts not pre-staged."
|
& $Log "Warning: no <Extensions><File> nodes found in autounattend.xml - setup scripts not pre-staged."
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
& $Log "Warning: could not pre-stage setup scripts from autounattend.xml: $_"
|
& $Log "Warning: could not pre-stage setup scripts from autounattend.xml: $_"
|
||||||
@@ -255,7 +255,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
& $Log "Written autounattend.xml to ISO root ($isoDest)."
|
& $Log "Written autounattend.xml to ISO root ($isoDest)."
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
& $Log "Warning: autounattend.xml content is empty — skipping OOBE bypass file."
|
& $Log "Warning: autounattend.xml content is empty - skipping OOBE bypass file."
|
||||||
}
|
}
|
||||||
|
|
||||||
& $Log "Disabling reserved storage..."
|
& $Log "Disabling reserved storage..."
|
||||||
@@ -323,7 +323,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
reg unload HKLM\zSOFTWARE
|
reg unload HKLM\zSOFTWARE
|
||||||
reg unload HKLM\zSYSTEM
|
reg unload HKLM\zSYSTEM
|
||||||
|
|
||||||
# ── 4. Delete scheduled task definition files ─────────────────────────────
|
# -- 4. Delete scheduled task definition files -----------------------------
|
||||||
& $Log "Deleting scheduled task definition files..."
|
& $Log "Deleting scheduled task definition files..."
|
||||||
$tasksPath = "$ScratchDir\Windows\System32\Tasks"
|
$tasksPath = "$ScratchDir\Windows\System32\Tasks"
|
||||||
Remove-Item "$tasksPath\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -Force
|
Remove-Item "$tasksPath\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -Force
|
||||||
@@ -339,7 +339,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
Remove-Item "$tasksPath\Microsoft\WindowsUpdate" -Recurse -Force
|
Remove-Item "$tasksPath\Microsoft\WindowsUpdate" -Recurse -Force
|
||||||
& $Log "Scheduled task files deleted."
|
& $Log "Scheduled task files deleted."
|
||||||
|
|
||||||
# ── 5. Remove ISO support folder ─────────────────────────────────────────
|
# -- 5. Remove ISO support folder -----------------------------------------
|
||||||
if ($ISOContentsDir -and (Test-Path $ISOContentsDir)) {
|
if ($ISOContentsDir -and (Test-Path $ISOContentsDir)) {
|
||||||
& $Log "Removing ISO support\ folder..."
|
& $Log "Removing ISO support\ folder..."
|
||||||
Remove-Item -Path (Join-Path $ISOContentsDir "support") -Recurse -Force
|
Remove-Item -Path (Join-Path $ISOContentsDir "support") -Recurse -Force
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function Reset-WPFCheckBoxes {
|
|||||||
|
|
||||||
if($doToggles) {
|
if($doToggles) {
|
||||||
# Restore toggle switch states from imported config.
|
# Restore toggle switch states from imported config.
|
||||||
# Only act on toggles that are explicitly listed in the import — toggles absent
|
# Only act on toggles that are explicitly listed in the import - toggles absent
|
||||||
# from the export file were not part of the saved config and should keep whatever
|
# from the export file were not part of the saved config and should keep whatever
|
||||||
# state the live system already has (set during UI initialisation via Get-WinUtilToggleStatus).
|
# state the live system already has (set during UI initialisation via Get-WinUtilToggleStatus).
|
||||||
$importedToggles = $sync.selectedToggles
|
$importedToggles = $sync.selectedToggles
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
param (
|
param (
|
||||||
[string]$Config,
|
[string]$Config,
|
||||||
[ValidateSet("Standard", "Minimal", "Advanced")]
|
[ValidateSet("Standard", "Minimal", "Advanced", "")]
|
||||||
[string]$Preset,
|
[string]$Preset,
|
||||||
[switch]$Noui,
|
[switch]$Noui,
|
||||||
[switch]$Offline
|
[switch]$Offline
|
||||||
|
|||||||
Reference in New Issue
Block a user