Skip to content

Commit f9c5468

Browse files
Merge branch 'main' into microwin-2026
2 parents b06ae8f + 79ee9db commit f9c5468

File tree

5 files changed

+95
-302
lines changed

5 files changed

+95
-302
lines changed

config/feature.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,7 @@
100100
"Order": "a018_",
101101
"feature": [],
102102
"InvokeScript": [
103-
"
104-
If (!(Test-Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager\\LastKnownGood')) {
105-
New-Item -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager\\LastKnownGood' -Force | Out-Null
106-
}
107-
New-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager\\LastKnownGood' -Name 'Enabled' -Type DWord -Value 1 -Force
108-
Start-Process -FilePath cmd.exe -ArgumentList '/c bcdedit /Set {Current} BootMenuPolicy Legacy' -Wait
109-
"
103+
"bcdedit /set bootmenupolicy legacy"
110104
],
111105
"link": "https://winutil.christitus.com/dev/features/features/enablelegacyrecovery"
112106
},
@@ -118,13 +112,7 @@
118112
"Order": "a019_",
119113
"feature": [],
120114
"InvokeScript": [
121-
"
122-
If (!(Test-Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager\\LastKnownGood')) {
123-
New-Item -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager\\LastKnownGood' -Force | Out-Null
124-
}
125-
New-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager\\LastKnownGood' -Name 'Enabled' -Type DWord -Value 0 -Force
126-
Start-Process -FilePath cmd.exe -ArgumentList '/c bcdedit /Set {Current} BootMenuPolicy Standard' -Wait
127-
"
115+
"bcdedit /set bootmenupolicy standard"
128116
],
129117
"link": "https://winutil.christitus.com/dev/features/features/disablelegacyrecovery"
130118
},

functions/private/Remove-WinUtilAPPX.ps1

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,7 @@ function Remove-WinUtilAPPX {
1515
$Name
1616
)
1717

18-
try {
19-
Write-Host "Removing $Name"
20-
Get-AppxPackage "*$Name*" | Remove-AppxPackage -ErrorAction SilentlyContinue
21-
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$Name*" | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
22-
} catch [System.Exception] {
23-
if ($psitem.Exception.Message -like "*The requested operation requires elevation*") {
24-
Write-Warning "Unable to uninstall $name due to a Security Exception"
25-
} else {
26-
Write-Warning "Unable to uninstall $name due to unhandled exception"
27-
Write-Warning $psitem.Exception.StackTrace
28-
}
29-
} catch {
30-
Write-Warning "Unable to uninstall $name due to unhandled exception"
31-
Write-Warning $psitem.Exception.StackTrace
32-
}
18+
Write-Host "Removing $Name"
19+
Get-AppxPackage $Name -AllUsers | Remove-AppxPackage -AllUsers
20+
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Name | Remove-AppxProvisionedPackage -Online
3321
}

functions/public/Invoke-WPFUpdatesdefault.ps1

Lines changed: 32 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -5,149 +5,51 @@ function Invoke-WPFUpdatesdefault {
55
Resets Windows Update settings to default
66
77
#>
8+
$ErrorActionPreference = 'SilentlyContinue'
89

9-
Write-Host "Restoring Windows Update registry settings..." -ForegroundColor Yellow
10+
Write-Host "Removing Windows Update policy settings..." -ForegroundColor Green
1011

11-
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
12-
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
13-
}
14-
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 0
15-
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 3
16-
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config")) {
17-
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Force | Out-Null
18-
}
19-
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1
20-
21-
# Reset WaaSMedicSvc registry settings to defaults
22-
Write-Host "Restoring WaaSMedicSvc settings..." -ForegroundColor Yellow
23-
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc" -Name "Start" -Type DWord -Value 3 -ErrorAction SilentlyContinue
24-
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc" -Name "FailureActions" -ErrorAction SilentlyContinue
25-
26-
# Restore update services to their default state
27-
Write-Host "Restoring update services..." -ForegroundColor Yellow
28-
29-
$services = @(
30-
@{Name = "BITS"; StartupType = "Manual"},
31-
@{Name = "wuauserv"; StartupType = "Manual"},
32-
@{Name = "UsoSvc"; StartupType = "Automatic"},
33-
@{Name = "uhssvc"; StartupType = "Disabled"},
34-
@{Name = "WaaSMedicSvc"; StartupType = "Manual"}
35-
)
36-
37-
foreach ($service in $services) {
38-
try {
39-
Write-Host "Restoring $($service.Name) to $($service.StartupType)..."
40-
$serviceObj = Get-Service -Name $service.Name -ErrorAction SilentlyContinue
41-
if ($serviceObj) {
42-
Set-Service -Name $service.Name -StartupType $service.StartupType -ErrorAction SilentlyContinue
43-
44-
# Reset failure actions to default using sc command
45-
Start-Process -FilePath "sc.exe" -ArgumentList "failure `"$($service.Name)`" reset= 86400 actions= restart/60000/restart/60000/restart/60000" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
12+
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Recurse -Force
13+
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Recurse -Force
14+
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Recurse -Force
15+
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Recurse -Force
16+
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Recurse -Force
17+
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Recurse -Force
4618

47-
# Start the service if it should be running
48-
if ($service.StartupType -eq "Automatic") {
49-
Start-Service -Name $service.Name -ErrorAction SilentlyContinue
50-
}
51-
}
52-
}
53-
catch {
54-
Write-Host "Warning: Could not restore service $($service.Name) - $($_.Exception.Message)" -ForegroundColor Yellow
55-
}
56-
}
57-
58-
# Restore renamed DLLs if they exist
59-
Write-Host "Restoring renamed update service DLLs..." -ForegroundColor Yellow
19+
Write-Host "Reenabling Windows Update Services..." -ForegroundColor Green
6020

61-
$dlls = @("WaaSMedicSvc", "wuaueng")
21+
Write-Host "Restored BITS to Manual"
22+
Set-Service -Name BITS -StartupType Manual
6223

63-
foreach ($dll in $dlls) {
64-
$dllPath = "C:\Windows\System32\$dll.dll"
65-
$backupPath = "C:\Windows\System32\${dll}_BAK.dll"
24+
Write-Host "Restored wuauserv to Manual"
25+
Set-Service -Name wuauserv -StartupType Manual
6626

67-
if ((Test-Path $backupPath) -and !(Test-Path $dllPath)) {
68-
try {
69-
# Take ownership of backup file
70-
Start-Process -FilePath "takeown.exe" -ArgumentList "/f `"$backupPath`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
27+
Write-Host "Restored UsoSvc to Automatic"
28+
Set-Service -Name UsoSvc -StartupType Automatic
7129

72-
# Grant full control to everyone
73-
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$backupPath`" /grant *S-1-1-0:F" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
30+
Write-Host "Restored WaaSMedicSvc to Manual"
31+
Set-Service -Name WaaSMedicSvc -StartupType Manual
7432

75-
# Rename back to original
76-
Rename-Item -Path $backupPath -NewName "$dll.dll" -ErrorAction SilentlyContinue
77-
Write-Host "Restored ${dll}_BAK.dll to $dll.dll"
78-
79-
# Restore ownership to TrustedInstaller
80-
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$dllPath`" /setowner `"NT SERVICE\TrustedInstaller`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
81-
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$dllPath`" /remove *S-1-1-0" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
82-
}
83-
catch {
84-
Write-Host "Warning: Could not restore $dll.dll - $($_.Exception.Message)" -ForegroundColor Yellow
85-
}
86-
}
87-
}
33+
Write-Host "Enabling update related scheduled tasks..." -ForegroundColor Green
8834

89-
# Enable update related scheduled tasks
90-
Write-Host "Enabling update related scheduled tasks..." -ForegroundColor Yellow
91-
92-
$taskPaths = @(
93-
'\Microsoft\Windows\InstallService\*'
94-
'\Microsoft\Windows\UpdateOrchestrator\*'
95-
'\Microsoft\Windows\UpdateAssistant\*'
96-
'\Microsoft\Windows\WaaSMedic\*'
97-
'\Microsoft\Windows\WindowsUpdate\*'
35+
$Tasks =
36+
'\Microsoft\Windows\InstallService\*',
37+
'\Microsoft\Windows\UpdateOrchestrator\*',
38+
'\Microsoft\Windows\UpdateAssistant\*',
39+
'\Microsoft\Windows\WaaSMedic\*',
40+
'\Microsoft\Windows\WindowsUpdate\*',
9841
'\Microsoft\WindowsUpdate\*'
99-
)
10042

101-
foreach ($taskPath in $taskPaths) {
102-
try {
103-
$tasks = Get-ScheduledTask -TaskPath $taskPath -ErrorAction SilentlyContinue
104-
foreach ($task in $tasks) {
105-
Enable-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath -ErrorAction SilentlyContinue
106-
Write-Host "Enabled task: $($task.TaskName)"
107-
}
108-
}
109-
catch {
110-
Write-Host "Warning: Could not enable tasks in path $taskPath - $($_.Exception.Message)" -ForegroundColor Yellow
111-
}
43+
foreach ($Task in $Tasks) {
44+
Get-ScheduledTask -TaskPath $Task | Enable-ScheduledTask -ErrorAction SilentlyContinue
11245
}
11346

114-
Write-Host "Enabling driver offering through Windows Update..."
115-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Name "PreventDeviceMetadataFromNetwork" -ErrorAction SilentlyContinue
116-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontPromptForWindowsUpdate" -ErrorAction SilentlyContinue
117-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontSearchWindowsUpdate" -ErrorAction SilentlyContinue
118-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DriverUpdateWizardWuSearchEnabled" -ErrorAction SilentlyContinue
119-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -ErrorAction SilentlyContinue
120-
Write-Host "Enabling Windows Update automatic restart..."
121-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoRebootWithLoggedOnUsers" -ErrorAction SilentlyContinue
122-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUPowerManagement" -ErrorAction SilentlyContinue
123-
Write-Host "Enabled driver offering through Windows Update"
124-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "BranchReadinessLevel" -ErrorAction SilentlyContinue
125-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferFeatureUpdatesPeriodInDays" -ErrorAction SilentlyContinue
126-
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferQualityUpdatesPeriodInDays" -ErrorAction SilentlyContinue
127-
128-
Write-Host "==================================================="
129-
Write-Host "--- Windows Update Settings Reset to Default ---"
130-
Write-Host "==================================================="
131-
132-
Start-Process -FilePath "secedit" -ArgumentList "/configure /cfg $env:windir\inf\defltbase.inf /db defltbase.sdb /verbose" -Wait
133-
Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicyUsers" -Wait
134-
Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicy" -Wait
135-
Start-Process -FilePath "gpupdate" -ArgumentList "/force" -Wait
136-
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
137-
Remove-Item -Path "HKCU:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue
138-
Remove-Item -Path "HKCU:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue
139-
Remove-Item -Path "HKLM:\Software\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue
140-
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
141-
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
142-
Remove-Item -Path "HKLM:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue
143-
Remove-Item -Path "HKLM:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue
144-
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue
145-
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
146-
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
47+
Write-Host "Windows Local Policies Reset to Default"
48+
secedit /configure /cfg "$Env:SystemRoot\inf\defltbase.inf" /db defltbase.sdb
14749

148-
Write-Host "==================================================="
149-
Write-Host "--- Windows Local Policies Reset to Default ---"
150-
Write-Host "==================================================="
50+
Write-Host "===================================================" -ForegroundColor Green
51+
Write-Host "--- Windows Update Settings Reset to Default ---" -ForegroundColor Green
52+
Write-Host "===================================================" -ForegroundColor Green
15153

152-
Write-Host "Note: A system restart may be required for all changes to take full effect." -ForegroundColor Yellow
54+
Write-Host "Note: You must restart your system in order for all changes to take effect." -ForegroundColor Yellow
15355
}

0 commit comments

Comments
 (0)