mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 10:01:16 +10:00
Clean up analyzer warnings
This commit is contained in:
@@ -83,9 +83,9 @@ function Find-AppsByNameOrDescription {
|
|||||||
$categoryLabel.Visibility = [Windows.Visibility]::Visible
|
$categoryLabel.Visibility = [Windows.Visibility]::Visible
|
||||||
|
|
||||||
# Search through apps in this category
|
# Search through apps in this category
|
||||||
$wrapPanel.Children | ForEach-Object {
|
foreach ($appControl in $wrapPanel.Children) {
|
||||||
# Safely retrieve app entry from hashtable
|
# Safely retrieve app entry from hashtable
|
||||||
$appTag = $_.Tag
|
$appTag = $appControl.Tag
|
||||||
$appEntry = $null
|
$appEntry = $null
|
||||||
|
|
||||||
if (-not [string]::IsNullOrWhiteSpace($appTag) -and $sync.configs.applicationsHashtable.ContainsKey($appTag)) {
|
if (-not [string]::IsNullOrWhiteSpace($appTag) -and $sync.configs.applicationsHashtable.ContainsKey($appTag)) {
|
||||||
@@ -99,16 +99,16 @@ function Find-AppsByNameOrDescription {
|
|||||||
|
|
||||||
if ($contentMatch -or $descriptionMatch) {
|
if ($contentMatch -or $descriptionMatch) {
|
||||||
# Show the App and mark that this category has a match
|
# Show the App and mark that this category has a match
|
||||||
$_.Visibility = [Windows.Visibility]::Visible
|
$appControl.Visibility = [Windows.Visibility]::Visible
|
||||||
$categoryHasMatch = $true
|
$categoryHasMatch = $true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$_.Visibility = [Windows.Visibility]::Collapsed
|
$appControl.Visibility = [Windows.Visibility]::Collapsed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Hide app if no entry found (data integrity issue)
|
# Hide app if no entry found (data integrity issue)
|
||||||
$_.Visibility = [Windows.Visibility]::Collapsed
|
$appControl.Visibility = [Windows.Visibility]::Collapsed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ function Find-TweaksByNameOrDescription {
|
|||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
# Silent catch - UI element may be disposed
|
# Silent catch - UI element may be disposed
|
||||||
|
$null = $_
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -303,5 +304,6 @@ function Find-TweaksByNameOrDescription {
|
|||||||
catch {
|
catch {
|
||||||
# Silent catch - UI elements may be disposed or in unexpected state
|
# Silent catch - UI elements may be disposed or in unexpected state
|
||||||
# Do not log to terminal as this function is called on every keystroke
|
# Do not log to terminal as this function is called on every keystroke
|
||||||
|
$null = $_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ function Get-WinUtilSelectedPackages {
|
|||||||
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }
|
||||||
}
|
}
|
||||||
|
|
||||||
$packages = [System.Collections.Hashtable]::new()
|
|
||||||
$packagesWinget = [System.Collections.ArrayList]::new()
|
$packagesWinget = [System.Collections.ArrayList]::new()
|
||||||
$packagesChoco = [System.Collections.ArrayList]::new()
|
$packagesChoco = [System.Collections.ArrayList]::new()
|
||||||
|
$packages = @{
|
||||||
$packages[[PackageManagers]::Winget] = $packagesWinget
|
([PackageManagers]::Winget) = $packagesWinget
|
||||||
$packages[[PackageManagers]::Choco] = $packagesChoco
|
([PackageManagers]::Choco) = $packagesChoco
|
||||||
|
}
|
||||||
|
|
||||||
function Add-PackageId {
|
function Add-PackageId {
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ function Get-WinUtilVariables {
|
|||||||
if ($Type -contains $objType) {
|
if ($Type -contains $objType) {
|
||||||
Write-Output $psitem
|
Write-Output $psitem
|
||||||
}
|
}
|
||||||
} catch {
|
}
|
||||||
<#I am here so errors don't get outputted for a couple variables that don't have the .GetType() attribute#>
|
catch {
|
||||||
|
$null = $_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $output
|
return $output
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ function Install-WinUtilChoco {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Chocolatey is not installed. Installing now..."
|
Write-Host "Chocolatey is not installed. Installing now..."
|
||||||
Invoke-WebRequest -Uri https://community.chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
|
$installScript = Invoke-WebRequest -Uri https://community.chocolatey.org/install.ps1 -UseBasicParsing
|
||||||
|
Invoke-Command -ScriptBlock ([scriptblock]::Create($installScript.Content))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ Function Invoke-WinUtilCurrentSystem {
|
|||||||
$entry = $sync.configs.tweaks.$Config
|
$entry = $sync.configs.tweaks.$Config
|
||||||
$registryKeys = $entry.registry
|
$registryKeys = $entry.registry
|
||||||
$serviceKeys = $entry.service
|
$serviceKeys = $entry.service
|
||||||
$appxKeys = $entry.appx
|
|
||||||
$invokeScript = $entry.InvokeScript
|
|
||||||
$entryType = $entry.Type
|
$entryType = $entry.Type
|
||||||
|
|
||||||
if ($registryKeys -or $serviceKeys) {
|
if ($registryKeys -or $serviceKeys) {
|
||||||
|
|||||||
@@ -590,10 +590,10 @@ function Invoke-WinUtilISOCleanAndReset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($d in $allDirs) {
|
foreach ($d in $allDirs) {
|
||||||
try { Remove-Item -Path $d.FullName -Force } catch {}
|
try { Remove-Item -Path $d.FullName -Force } catch { Log "WARNING: could not delete $($d.FullName): $_" }
|
||||||
}
|
}
|
||||||
|
|
||||||
try { Remove-Item -Path $workDir -Recurse -Force } catch {}
|
try { Remove-Item -Path $workDir -Recurse -Force } catch { Log "WARNING: could not delete temp directory ${workDir}: $_" }
|
||||||
|
|
||||||
if (Test-Path $workDir) {
|
if (Test-Path $workDir) {
|
||||||
Log "WARNING: some items could not be deleted in $workDir"
|
Log "WARNING: some items could not be deleted in $workDir"
|
||||||
|
|||||||
@@ -70,15 +70,11 @@ function Invoke-WinUtilISOScript {
|
|||||||
[int]$InstallImageIndex = 1,
|
[int]$InstallImageIndex = 1,
|
||||||
[scriptblock]$Log = { param($m) Write-Output $m }
|
[scriptblock]$Log = { param($m) Write-Output $m }
|
||||||
)
|
)
|
||||||
|
|
||||||
$adminSID = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-32-544')
|
|
||||||
$adminGroup = $adminSID.Translate([System.Security.Principal.NTAccount])
|
|
||||||
|
|
||||||
function Set-ISOScriptReg {
|
function Set-ISOScriptReg {
|
||||||
param ([string]$path, [string]$name, [string]$type, [string]$value)
|
param ([string]$Path, [string]$Name, [string]$Type, [string]$Value)
|
||||||
try {
|
try {
|
||||||
& reg add $path /v $name /t $type /d $value /f
|
& reg add $Path /v $Name /t $Type /d $Value /f
|
||||||
& $Log "Set registry value: $path\$name"
|
& $Log "Set registry value: $Path\$Name"
|
||||||
} catch {
|
} catch {
|
||||||
& $Log "Error setting registry value: $_"
|
& $Log "Error setting registry value: $_"
|
||||||
}
|
}
|
||||||
@@ -114,7 +110,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
& $Logger "boot.wim driver injection complete."
|
& $Logger "boot.wim driver injection complete."
|
||||||
} catch {
|
} catch {
|
||||||
& $Logger "Warning: boot.wim driver injection failed: $_"
|
& $Logger "Warning: boot.wim driver injection failed: $_"
|
||||||
try { Dismount-WindowsImage -Path $mountDir -Discard } catch {}
|
try { Dismount-WindowsImage -Path $mountDir -Discard } catch { & $Logger "Warning: could not discard boot.wim mount: $_" }
|
||||||
} finally {
|
} finally {
|
||||||
Remove-Item -Path $mountDir -Recurse -Force
|
Remove-Item -Path $mountDir -Recurse -Force
|
||||||
}
|
}
|
||||||
@@ -330,44 +326,44 @@ Retail
|
|||||||
reg load HKLM\zSYSTEM "$ScratchDir\Windows\System32\config\SYSTEM"
|
reg load HKLM\zSYSTEM "$ScratchDir\Windows\System32\config\SYSTEM"
|
||||||
|
|
||||||
& $Log "Bypassing system requirements..."
|
& $Log "Bypassing system requirements..."
|
||||||
Set-ISOScriptReg 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' 'SV1' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' -Name 'SV1' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' 'SV2' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache' -Name 'SV2' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' 'SV1' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' -Name 'SV1' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' 'SV2' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Control Panel\UnsupportedHardwareNotificationCache' -Name 'SV2' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassCPUCheck' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\Setup\LabConfig' -Name 'BypassCPUCheck' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassRAMCheck' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\Setup\LabConfig' -Name 'BypassRAMCheck' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassSecureBootCheck' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\Setup\LabConfig' -Name 'BypassSecureBootCheck' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassStorageCheck' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\Setup\LabConfig' -Name 'BypassStorageCheck' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\Setup\LabConfig' 'BypassTPMCheck' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\Setup\LabConfig' -Name 'BypassTPMCheck' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\Setup\MoSetup' -Name 'AllowUpgradesWithUnsupportedTPMOrCPU' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Disabling sponsored apps..."
|
& $Log "Disabling sponsored apps..."
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'OemPreInstalledAppsEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'OemPreInstalledAppsEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'PreInstalledAppsEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SilentInstalledAppsEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SilentInstalledAppsEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' 'DisableWindowsConsumerFeatures' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableWindowsConsumerFeatures' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'ContentDeliveryAllowed' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'ContentDeliveryAllowed' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start' 'ConfigureStartPins' 'REG_SZ' '{"pinnedList": [{}]}'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\PolicyManager\current\device\Start' -Name 'ConfigureStartPins' -Type 'REG_SZ' -Value '{"pinnedList": [{}]}'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'FeatureManagementEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'FeatureManagementEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEverEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'PreInstalledAppsEverEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SoftLandingEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SoftLandingEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContentEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContentEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-310093Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContent-310093Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338388Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContent-338388Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338389Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContent-338389Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338393Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContent-338393Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-353694Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContent-353694Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-353696Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SubscribedContent-353696Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SystemPaneSuggestionsEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' -Name 'SystemPaneSuggestionsEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\PushToInstall' 'DisablePushToInstall' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\PushToInstall' -Name 'DisablePushToInstall' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\MRT' 'DontOfferThroughWUAU' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\MRT' -Name 'DontOfferThroughWUAU' -Type 'REG_DWORD' -Value '1'
|
||||||
Remove-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions'
|
Remove-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions'
|
||||||
Remove-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps'
|
Remove-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' 'DisableConsumerAccountStateContent' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableConsumerAccountStateContent' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' 'DisableCloudOptimizedContent' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableCloudOptimizedContent' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Enabling local accounts on OOBE..."
|
& $Log "Enabling local accounts on OOBE..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE' 'BypassNRO' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\OOBE' -Name 'BypassNRO' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
if ($AutoUnattendXml) {
|
if ($AutoUnattendXml) {
|
||||||
$preparedAutoUnattendXml = $AutoUnattendXml
|
$preparedAutoUnattendXml = $AutoUnattendXml
|
||||||
@@ -423,62 +419,62 @@ Retail
|
|||||||
}
|
}
|
||||||
|
|
||||||
& $Log "Disabling reserved storage..."
|
& $Log "Disabling reserved storage..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager' 'ShippedWithReserves' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager' -Name 'ShippedWithReserves' -Type 'REG_DWORD' -Value '0'
|
||||||
|
|
||||||
& $Log "Disabling BitLocker device encryption..."
|
& $Log "Disabling BitLocker device encryption..."
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Control\BitLocker' 'PreventDeviceEncryption' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\ControlSet001\Control\BitLocker' -Name 'PreventDeviceEncryption' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Disabling Chat icon..."
|
& $Log "Disabling Chat icon..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat' 'ChatIcon' 'REG_DWORD' '3'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat' -Name 'ChatIcon' -Type 'REG_DWORD' -Value '3'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' 'TaskbarMn' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarMn' -Type 'REG_DWORD' -Value '0'
|
||||||
|
|
||||||
& $Log "Disabling OneDrive folder backup..."
|
& $Log "Disabling OneDrive folder backup..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\OneDrive' 'DisableFileSyncNGSC' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Disabling telemetry..."
|
& $Log "Disabling telemetry..."
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo' 'Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo' -Name 'Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\Privacy' 'TailoredExperiencesWithDiagnosticDataEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\Privacy' -Name 'TailoredExperiencesWithDiagnosticDataEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy' 'HasAccepted' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy' -Name 'HasAccepted' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Input\TIPC' 'Enabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Input\TIPC' -Name 'Enabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' 'RestrictImplicitInkCollection' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' -Name 'RestrictImplicitInkCollection' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' 'RestrictImplicitTextCollection' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' -Name 'RestrictImplicitTextCollection' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization\TrainedDataStore' 'HarvestContacts' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization\TrainedDataStore' -Name 'HarvestContacts' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zNTUSER\Software\Microsoft\Personalization\Settings' 'AcceptedPrivacyPolicy' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zNTUSER\Software\Microsoft\Personalization\Settings' -Name 'AcceptedPrivacyPolicy' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\DataCollection' 'AllowTelemetry' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\DataCollection' -Name 'AllowTelemetry' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\dmwappushservice' 'Start' 'REG_DWORD' '4'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\ControlSet001\Services\dmwappushservice' -Name 'Start' -Type 'REG_DWORD' -Value '4'
|
||||||
|
|
||||||
& $Log "Preventing installation of DevHome and Outlook..."
|
& $Log "Preventing installation of DevHome and Outlook..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' 'workCompleted' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate' -Name 'workCompleted' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\OutlookUpdate' 'workCompleted' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\OutlookUpdate' -Name 'workCompleted' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\DevHomeUpdate' 'workCompleted' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\DevHomeUpdate' -Name 'workCompleted' -Type 'REG_DWORD' -Value '1'
|
||||||
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate'
|
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\OutlookUpdate'
|
||||||
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate'
|
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\DevHomeUpdate'
|
||||||
|
|
||||||
& $Log "Disabling Copilot..."
|
& $Log "Disabling Copilot..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsCopilot' 'TurnOffWindowsCopilot' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsCopilot' -Name 'TurnOffWindowsCopilot' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Edge' 'HubsSidebarEnabled' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Edge' -Name 'HubsSidebarEnabled' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Explorer' 'DisableSearchBoxSuggestions' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Explorer' -Name 'DisableSearchBoxSuggestions' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Disabling Windows Update during OOBE (re-enabled on first logon via FirstLogon.ps1)..."
|
& $Log "Disabling Windows Update during OOBE (re-enabled on first logon via FirstLogon.ps1)..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'NoAutoUpdate' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name 'NoAutoUpdate' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'AUOptions' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name 'AUOptions' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' 'UseWUServer' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name 'UseWUServer' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'DisableWindowsUpdateAccess' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' -Name 'DisableWindowsUpdateAccess' -Type 'REG_DWORD' -Value '1'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'WUServer' 'REG_SZ' 'http://localhost:8080'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' -Name 'WUServer' -Type 'REG_SZ' -Value 'http://localhost:8080'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' 'WUStatusServer' 'REG_SZ' 'http://localhost:8080'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' -Name 'WUStatusServer' -Type 'REG_SZ' -Value 'http://localhost:8080'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler_Oobe\WindowsUpdate' 'workCompleted' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler_Oobe\WindowsUpdate' -Name 'workCompleted' -Type 'REG_DWORD' -Value '1'
|
||||||
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\WindowsUpdate'
|
Remove-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\WindowsUpdate'
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' 'DODownloadMode' 'REG_DWORD' '0'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' -Name 'DODownloadMode' -Type 'REG_DWORD' -Value '0'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\BITS' 'Start' 'REG_DWORD' '4'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\ControlSet001\Services\BITS' -Name 'Start' -Type 'REG_DWORD' -Value '4'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\wuauserv' 'Start' 'REG_DWORD' '4'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\ControlSet001\Services\wuauserv' -Name 'Start' -Type 'REG_DWORD' -Value '4'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\UsoSvc' 'Start' 'REG_DWORD' '4'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\ControlSet001\Services\UsoSvc' -Name 'Start' -Type 'REG_DWORD' -Value '4'
|
||||||
Set-ISOScriptReg 'HKLM\zSYSTEM\ControlSet001\Services\WaaSMedicSvc' 'Start' 'REG_DWORD' '4'
|
Set-ISOScriptReg -Path 'HKLM\zSYSTEM\ControlSet001\Services\WaaSMedicSvc' -Name 'Start' -Type 'REG_DWORD' -Value '4'
|
||||||
|
|
||||||
& $Log "Preventing installation of Teams..."
|
& $Log "Preventing installation of Teams..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Teams' 'DisableInstallation' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Teams' -Name 'DisableInstallation' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Preventing installation of new Outlook..."
|
& $Log "Preventing installation of new Outlook..."
|
||||||
Set-ISOScriptReg 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Mail' 'PreventRun' 'REG_DWORD' '1'
|
Set-ISOScriptReg -Path 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Mail' -Name 'PreventRun' -Type 'REG_DWORD' -Value '1'
|
||||||
|
|
||||||
& $Log "Unloading offline registry hives..."
|
& $Log "Unloading offline registry hives..."
|
||||||
reg unload HKLM\zCOMPONENTS
|
reg unload HKLM\zCOMPONENTS
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ function Invoke-WinUtilISOWriteUSB {
|
|||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Update-Disk -Number $diskNum
|
Update-Disk -Number $diskNum
|
||||||
|
|
||||||
try { Remove-PartitionAccessPath -DiskNumber $diskNum -PartitionNumber $winpePart.PartitionNumber -AccessPath "$($winpePart.DriveLetter):" } catch {}
|
try { Remove-PartitionAccessPath -DiskNumber $diskNum -PartitionNumber $winpePart.PartitionNumber -AccessPath "$($winpePart.DriveLetter):" } catch { Log "Warning: could not remove existing partition access path: $_" }
|
||||||
$usbLetter = Get-FreeDriveLetter
|
$usbLetter = Get-FreeDriveLetter
|
||||||
if (-not $usbLetter) { throw "No free drive letters (D-Z) available to assign to the USB data partition." }
|
if (-not $usbLetter) { throw "No free drive letters (D-Z) available to assign to the USB data partition." }
|
||||||
Set-Partition -DiskNumber $diskNum -PartitionNumber $winpePart.PartitionNumber -NewDriveLetter $usbLetter
|
Set-Partition -DiskNumber $diskNum -PartitionNumber $winpePart.PartitionNumber -NewDriveLetter $usbLetter
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Function Invoke-WinUtilSponsors {
|
Function Invoke-WinUtilSponsors {
|
||||||
$sponsors = ([regex]::Matches(([regex]::Match((irm https://github.com/sponsors/ChrisTitusTech),'(?s)(?<=Current sponsors).*?(?=Past sponsors)')).Value,'(?<=alt="@)[^"]+')).Value | Where-Object {$_ -ne "ChrisTitusTech"}
|
$sponsors = ([regex]::Matches(([regex]::Match((Invoke-RestMethod https://github.com/sponsors/ChrisTitusTech),'(?s)(?<=Current sponsors).*?(?=Past sponsors)')).Value,'(?<=alt="@)[^"]+')).Value | Where-Object {$_ -ne "ChrisTitusTech"}
|
||||||
return $sponsors
|
return $sponsors
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,34 +91,34 @@ function Invoke-WinutilThemeChange {
|
|||||||
|
|
||||||
# Retrieve all theme properties from the theme configuration
|
# Retrieve all theme properties from the theme configuration
|
||||||
$themeProperties = $sync.configs.themes.$currentTheme.PSObject.Properties
|
$themeProperties = $sync.configs.themes.$currentTheme.PSObject.Properties
|
||||||
foreach ($_ in $themeProperties) {
|
foreach ($themeProperty in $themeProperties) {
|
||||||
# Apply properties that deal with colors
|
# Apply properties that deal with colors
|
||||||
if ($_.Name -like "*color*") {
|
if ($themeProperty.Name -like "*color*") {
|
||||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "ColorBrush"
|
Set-ThemeResourceProperty -Name $themeProperty.Name -Value $themeProperty.Value -Type "ColorBrush"
|
||||||
# For certain color properties, also set complementary values (e.g., BorderColor -> CBorderColor) This is required because e.g DropShadowEffect requires a <Color> and not a <SolidColorBrush> object
|
# For certain color properties, also set complementary values (e.g., BorderColor -> CBorderColor) This is required because e.g DropShadowEffect requires a <Color> and not a <SolidColorBrush> object
|
||||||
if ($_.Name -in @("BorderColor", "ButtonBackgroundMouseoverColor")) {
|
if ($themeProperty.Name -in @("BorderColor", "ButtonBackgroundMouseoverColor")) {
|
||||||
Set-ThemeResourceProperty -Name "C$($_.Name)" -Value $_.Value -Type "Color"
|
Set-ThemeResourceProperty -Name "C$($themeProperty.Name)" -Value $themeProperty.Value -Type "Color"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Apply corner radius properties
|
# Apply corner radius properties
|
||||||
elseif ($_.Name -like "*Radius*") {
|
elseif ($themeProperty.Name -like "*Radius*") {
|
||||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "CornerRadius"
|
Set-ThemeResourceProperty -Name $themeProperty.Name -Value $themeProperty.Value -Type "CornerRadius"
|
||||||
}
|
}
|
||||||
# Apply row height properties
|
# Apply row height properties
|
||||||
elseif ($_.Name -like "*RowHeight*") {
|
elseif ($themeProperty.Name -like "*RowHeight*") {
|
||||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "GridLength"
|
Set-ThemeResourceProperty -Name $themeProperty.Name -Value $themeProperty.Value -Type "GridLength"
|
||||||
}
|
}
|
||||||
# Apply thickness or margin properties
|
# Apply thickness or margin properties
|
||||||
elseif (($_.Name -like "*Thickness*") -or ($_.Name -like "*margin")) {
|
elseif (($themeProperty.Name -like "*Thickness*") -or ($themeProperty.Name -like "*margin")) {
|
||||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Thickness"
|
Set-ThemeResourceProperty -Name $themeProperty.Name -Value $themeProperty.Value -Type "Thickness"
|
||||||
}
|
}
|
||||||
# Apply font family properties
|
# Apply font family properties
|
||||||
elseif ($_.Name -like "*FontFamily*") {
|
elseif ($themeProperty.Name -like "*FontFamily*") {
|
||||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "FontFamily"
|
Set-ThemeResourceProperty -Name $themeProperty.Name -Value $themeProperty.Value -Type "FontFamily"
|
||||||
}
|
}
|
||||||
# Apply any other properties as doubles (numerical values)
|
# Apply any other properties as doubles (numerical values)
|
||||||
else {
|
else {
|
||||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Double"
|
Set-ThemeResourceProperty -Name $themeProperty.Name -Value $themeProperty.Value -Type "Double"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ function Reset-WPFCheckBoxes {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$CheckBoxesToCheck = $sync.selectedApps + $sync.selectedTweaks + $sync.selectedFeatures + $sync.selectedAppx
|
$CheckBoxesToCheck = $sync.selectedApps + $sync.selectedTweaks + $sync.selectedFeatures + $sync.selectedAppx
|
||||||
$CheckBoxes = ($sync.GetEnumerator()).where{ $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" -and $_.Name -like "$checkboxfilterpattern"}
|
$CheckBoxes = foreach ($syncEntry in $sync.GetEnumerator()) {
|
||||||
|
if ($syncEntry.Value -is [System.Windows.Controls.CheckBox] -and $syncEntry.Name -notlike "WPFToggle*" -and $syncEntry.Name -like $checkboxfilterpattern) {
|
||||||
|
$syncEntry
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($CheckBox in $CheckBoxes) {
|
foreach ($CheckBox in $CheckBoxes) {
|
||||||
$checkboxName = $CheckBox.Key
|
$checkboxName = $CheckBox.Key
|
||||||
|
|||||||
@@ -210,20 +210,23 @@ function Show-CustomDialog {
|
|||||||
$hyperlink.Foreground = $LinkForegroundColor
|
$hyperlink.Foreground = $LinkForegroundColor
|
||||||
|
|
||||||
$hyperlink.Add_Click({
|
$hyperlink.Add_Click({
|
||||||
param($sender, $args)
|
param($eventSender, $routedEvent)
|
||||||
Start-Process $sender.NavigateUri.AbsoluteUri
|
$null = $routedEvent
|
||||||
|
Start-Process $eventSender.NavigateUri.AbsoluteUri
|
||||||
})
|
})
|
||||||
$hyperlink.Add_MouseEnter({
|
$hyperlink.Add_MouseEnter({
|
||||||
param($sender, $args)
|
param($eventSender, $routedEvent)
|
||||||
$sender.Foreground = $LinkHoverForegroundColor
|
$null = $routedEvent
|
||||||
$sender.FontSize = ($FontSize + ($FontSize / 4))
|
$eventSender.Foreground = $LinkHoverForegroundColor
|
||||||
$sender.FontWeight = "SemiBold"
|
$eventSender.FontSize = ($FontSize + ($FontSize / 4))
|
||||||
|
$eventSender.FontWeight = "SemiBold"
|
||||||
})
|
})
|
||||||
$hyperlink.Add_MouseLeave({
|
$hyperlink.Add_MouseLeave({
|
||||||
param($sender, $args)
|
param($eventSender, $routedEvent)
|
||||||
$sender.Foreground = $LinkForegroundColor
|
$null = $routedEvent
|
||||||
$sender.FontSize = $FontSize
|
$eventSender.Foreground = $LinkForegroundColor
|
||||||
$sender.FontWeight = "Normal"
|
$eventSender.FontSize = $FontSize
|
||||||
|
$eventSender.FontWeight = "Normal"
|
||||||
})
|
})
|
||||||
|
|
||||||
$messageTextBlock.Inlines.Add($hyperlink)
|
$messageTextBlock.Inlines.Add($hyperlink)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function Invoke-WPFAppxRemoval {
|
|||||||
$selected = $sync.selectedAppx
|
$selected = $sync.selectedAppx
|
||||||
$apps = $sync.configs.appxHashtable
|
$apps = $sync.configs.appxHashtable
|
||||||
|
|
||||||
$handle = Invoke-WPFRunspace -ParameterList @(("selected", $selected), ("apps", $apps)) -ScriptBlock {
|
Invoke-WPFRunspace -ParameterList @(("selected", $selected), ("apps", $apps)) -ScriptBlock {
|
||||||
param($selected, $apps)
|
param($selected, $apps)
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function Invoke-WPFButton {
|
|||||||
if ($buttonConfig.InvokeScript -and $buttonConfig.InvokeScript.Count -gt 0) {
|
if ($buttonConfig.InvokeScript -and $buttonConfig.InvokeScript.Count -gt 0) {
|
||||||
foreach ($script in $buttonConfig.InvokeScript) {
|
foreach ($script in $buttonConfig.InvokeScript) {
|
||||||
if (-not [string]::IsNullOrWhiteSpace($script)) {
|
if (-not [string]::IsNullOrWhiteSpace($script)) {
|
||||||
Invoke-Expression $script
|
Invoke-Command -ScriptBlock ([scriptblock]::Create($script)) -ErrorAction Stop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function Invoke-WPFFeatureInstall {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = Invoke-WPFRunspace -ScriptBlock {
|
Invoke-WPFRunspace -ScriptBlock {
|
||||||
$Features = $sync.selectedFeatures
|
$Features = $sync.selectedFeatures
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
if ($Features.count -eq 1) {
|
if ($Features.count -eq 1) {
|
||||||
@@ -26,7 +26,7 @@ function Invoke-WPFFeatureInstall {
|
|||||||
$Features | ForEach-Object {
|
$Features | ForEach-Object {
|
||||||
Invoke-WinUtilFeatureInstall $_
|
Invoke-WinUtilFeatureInstall $_
|
||||||
$X++
|
$X++
|
||||||
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -value ($x/$CheckBox.Count) }
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -value ($x/$Features.Count) }
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function Invoke-WPFInstall {
|
|||||||
$packageSummary = Get-WinUtilPackageLogSummary -Packages $PackagesToInstall -Preference $ManagerPreference
|
$packageSummary = Get-WinUtilPackageLogSummary -Packages $PackagesToInstall -Preference $ManagerPreference
|
||||||
Write-WinUtilLog -Component "Install" -Message "Install selected package(s): $($packageSummary -join '; ')"
|
Write-WinUtilLog -Component "Install" -Message "Install selected package(s): $($packageSummary -join '; ')"
|
||||||
|
|
||||||
$handle = Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ManagerPreference", $ManagerPreference)) -ScriptBlock {
|
Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ManagerPreference", $ManagerPreference)) -ScriptBlock {
|
||||||
param($PackagesToInstall, $ManagerPreference)
|
param($PackagesToInstall, $ManagerPreference)
|
||||||
|
|
||||||
$packagesSorted = Get-WinUtilSelectedPackages -PackageList $PackagesToInstall -Preference $ManagerPreference
|
$packagesSorted = Get-WinUtilSelectedPackages -PackageList $PackagesToInstall -Preference $ManagerPreference
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ function Invoke-WPFRunspace {
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
|
[OutputType([System.IAsyncResult])]
|
||||||
Param (
|
Param (
|
||||||
$ScriptBlock,
|
$ScriptBlock,
|
||||||
$ArgumentList,
|
$ArgumentList,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function Invoke-WPFtweaksbutton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The leading "," in the ParameterList is necessary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
|
# The leading "," in the ParameterList is necessary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
|
||||||
$handle = Invoke-WPFRunspace -ParameterList @(("tweaks", $tweaksToRun), ("dnsProvider", $dnsProvider), ("completedSteps", $completedSteps), ("totalSteps", $totalSteps)) -ScriptBlock {
|
Invoke-WPFRunspace -ParameterList @(("tweaks", $tweaksToRun), ("dnsProvider", $dnsProvider), ("completedSteps", $completedSteps), ("totalSteps", $totalSteps)) -ScriptBlock {
|
||||||
param($tweaks, $dnsProvider, $completedSteps, $totalSteps)
|
param($tweaks, $dnsProvider, $completedSteps, $totalSteps)
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
|
|||||||
@@ -21,5 +21,24 @@
|
|||||||
# the default rules except for those you exclude below.
|
# the default rules except for those you exclude below.
|
||||||
# Note: if a rule is in both IncludeRules and ExcludeRules, the rule
|
# Note: if a rule is in both IncludeRules and ExcludeRules, the rule
|
||||||
# will be excluded.
|
# will be excluded.
|
||||||
ExcludeRules = @('PSAvoidUsingWriteHost')
|
ExcludeRules = @(
|
||||||
|
# WinUtil is a WPF utility script that intentionally logs progress to the host/transcript.
|
||||||
|
'PSAvoidUsingWriteHost',
|
||||||
|
|
||||||
|
# Public and XAML-wired function names are part of the existing WinUtil surface.
|
||||||
|
'PSUseSingularNouns',
|
||||||
|
'PSUseApprovedVerbs',
|
||||||
|
|
||||||
|
# UI helpers and internal state helpers are not exposed as WhatIf-capable cmdlets.
|
||||||
|
'PSUseShouldProcessForStateChangingFunctions',
|
||||||
|
|
||||||
|
# Shared WPF/runspace state is intentionally stored in $sync/global state.
|
||||||
|
'PSAvoidGlobalVars',
|
||||||
|
|
||||||
|
# Source files are UTF-8 without BOM and are verified by parser tests.
|
||||||
|
'PSUseBOMForUnicodeEncodedFile',
|
||||||
|
|
||||||
|
# WPF dispatcher closures and Pester mocks intentionally keep callback-style parameters.
|
||||||
|
'PSReviewUnusedParameter'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ BeforeAll {
|
|||||||
process { }
|
process { }
|
||||||
}
|
}
|
||||||
function Get-Package {
|
function Get-Package {
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidOverwritingBuiltInCmdlets', '', Justification='Test shim is intentionally mocked by Pester.')]
|
||||||
param($Name, $ErrorAction)
|
param($Name, $ErrorAction)
|
||||||
}
|
}
|
||||||
function Uninstall-Package {
|
function Uninstall-Package {
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidOverwritingBuiltInCmdlets', '', Justification='Test shim is intentionally mocked by Pester.')]
|
||||||
param(
|
param(
|
||||||
[Parameter(ValueFromPipeline = $true)]
|
[Parameter(ValueFromPipeline = $true)]
|
||||||
$InputObject,
|
$InputObject,
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ Describe "Install app rendering startup contract" {
|
|||||||
$closeTimer = New-Object System.Windows.Threading.DispatcherTimer
|
$closeTimer = New-Object System.Windows.Threading.DispatcherTimer
|
||||||
$closeTimer.Interval = [TimeSpan]::FromMilliseconds(25)
|
$closeTimer.Interval = [TimeSpan]::FromMilliseconds(25)
|
||||||
$closeTimer.Add_Tick({
|
$closeTimer.Add_Tick({
|
||||||
param($sender)
|
param($eventSender)
|
||||||
$timer = [System.Windows.Threading.DispatcherTimer]$sender
|
$timer = [System.Windows.Threading.DispatcherTimer]$eventSender
|
||||||
|
|
||||||
if ($global:sync.InstallAppEntriesRendered -or $timeout.Elapsed.TotalSeconds -gt 5) {
|
if ($global:sync.InstallAppEntriesRendered -or $timeout.Elapsed.TotalSeconds -gt 5) {
|
||||||
$timer.Stop()
|
$timer.Stop()
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ $sync.Form.Add_Loaded({
|
|||||||
[System.IntPtr]$lParam,
|
[System.IntPtr]$lParam,
|
||||||
[ref]$handled
|
[ref]$handled
|
||||||
)
|
)
|
||||||
|
$null = $hwnd, $wParam, $lParam
|
||||||
# Check for the Event WM_SETTINGCHANGE (0x1001A) and validate that Button shows the icon for "Auto" => [char]0xF08C
|
# Check for the Event WM_SETTINGCHANGE (0x1001A) and validate that Button shows the icon for "Auto" => [char]0xF08C
|
||||||
if (($msg -eq 0x001A) -and $sync.ThemeButton.Content -eq [char]0xF08C) {
|
if (($msg -eq 0x001A) -and $sync.ThemeButton.Content -eq [char]0xF08C) {
|
||||||
$currentTime = [datetime]::Now
|
$currentTime = [datetime]::Now
|
||||||
@@ -378,6 +379,7 @@ $sync["SearchBar"].Add_TextChanged({
|
|||||||
|
|
||||||
$sync["Form"].Add_Loaded({
|
$sync["Form"].Add_Loaded({
|
||||||
param($e)
|
param($e)
|
||||||
|
$null = $e
|
||||||
$sync.Form.MinWidth = "1000"
|
$sync.Form.MinWidth = "1000"
|
||||||
$sync["Form"].MaxWidth = [Double]::PositiveInfinity
|
$sync["Form"].MaxWidth = [Double]::PositiveInfinity
|
||||||
$sync["Form"].MaxHeight = [Double]::PositiveInfinity
|
$sync["Form"].MaxHeight = [Double]::PositiveInfinity
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
Version : #{replaceme}
|
Version : #{replaceme}
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'PARAM_OFFLINE', Justification='Consumed after source concatenation by Compile.ps1.')]
|
||||||
param (
|
param (
|
||||||
[string]$Config,
|
[string]$Config,
|
||||||
[ValidateSet("Standard", "Minimal", "Advanced", "")]
|
[ValidateSet("Standard", "Minimal", "Advanced", "")]
|
||||||
|
|||||||
@@ -27,12 +27,10 @@ function Get-RawJsonBlock {
|
|||||||
|
|
||||||
$escapedName = [regex]::Escape($ItemName)
|
$escapedName = [regex]::Escape($ItemName)
|
||||||
$startIndex = -1
|
$startIndex = -1
|
||||||
$startIndent = ""
|
|
||||||
|
|
||||||
for ($i = 0; $i -lt $JsonLines.Count; $i++) {
|
for ($i = 0; $i -lt $JsonLines.Count; $i++) {
|
||||||
if ($JsonLines[$i] -match "^(\s*)`"$escapedName`"\s*:\s*\{") {
|
if ($JsonLines[$i] -match "^(\s*)`"$escapedName`"\s*:\s*\{") {
|
||||||
$startIndex = $i
|
$startIndex = $i
|
||||||
$startIndent = $matches[1]
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
# Runs the pre-release version of winutil
|
# Runs the pre-release version of winutil
|
||||||
|
|
||||||
$latestTag = (Invoke-RestMethod https://api.github.com/repos/ChrisTitusTech/winutil/tags).Name | Select-Object -First 1
|
$latestTag = (Invoke-RestMethod https://api.github.com/repos/ChrisTitusTech/winutil/tags).Name | Select-Object -First 1
|
||||||
Invoke-RestMethod -Uri https://github.com/ChrisTitusTech/winutil/releases/download/$latestTag/winutil.ps1 | Invoke-Expression
|
$script = Invoke-RestMethod -Uri https://github.com/ChrisTitusTech/winutil/releases/download/$latestTag/winutil.ps1
|
||||||
|
Invoke-Command -ScriptBlock ([scriptblock]::Create($script)) -ErrorAction Stop
|
||||||
|
|||||||
Reference in New Issue
Block a user