Skip to content

Commit 8830eb3

Browse files
committed
Unrelated: indentation fixes from compile script
1 parent b5fa0e7 commit 8830eb3

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

functions/public/Invoke-WPFUpdatesdefault.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ function Invoke-WPFUpdatesdefault {
55
Resets Windows Update settings to default
66
77
#>
8-
8+
99
Write-Host "Restoring Windows Update registry settings..." -ForegroundColor Yellow
10-
10+
1111
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
1212
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
1313
}
@@ -25,7 +25,7 @@ function Invoke-WPFUpdatesdefault {
2525

2626
# Restore update services to their default state
2727
Write-Host "Restoring update services..." -ForegroundColor Yellow
28-
28+
2929
$services = @(
3030
@{Name = "BITS"; StartupType = "Manual"},
3131
@{Name = "wuauserv"; StartupType = "Manual"},
@@ -40,10 +40,10 @@ function Invoke-WPFUpdatesdefault {
4040
$serviceObj = Get-Service -Name $service.Name -ErrorAction SilentlyContinue
4141
if ($serviceObj) {
4242
Set-Service -Name $service.Name -StartupType $service.StartupType -ErrorAction SilentlyContinue
43-
43+
4444
# Reset failure actions to default using sc command
4545
Start-Process -FilePath "sc.exe" -ArgumentList "failure `"$($service.Name)`" reset= 86400 actions= restart/60000/restart/60000/restart/60000" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
46-
46+
4747
# Start the service if it should be running
4848
if ($service.StartupType -eq "Automatic") {
4949
Start-Service -Name $service.Name -ErrorAction SilentlyContinue
@@ -57,25 +57,25 @@ function Invoke-WPFUpdatesdefault {
5757

5858
# Restore renamed DLLs if they exist
5959
Write-Host "Restoring renamed update service DLLs..." -ForegroundColor Yellow
60-
60+
6161
$dlls = @("WaaSMedicSvc", "wuaueng")
62-
62+
6363
foreach ($dll in $dlls) {
6464
$dllPath = "C:\Windows\System32\$dll.dll"
6565
$backupPath = "C:\Windows\System32\${dll}_BAK.dll"
66-
66+
6767
if ((Test-Path $backupPath) -and !(Test-Path $dllPath)) {
6868
try {
6969
# Take ownership of backup file
7070
Start-Process -FilePath "takeown.exe" -ArgumentList "/f `"$backupPath`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
71-
71+
7272
# Grant full control to everyone
7373
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$backupPath`" /grant *S-1-1-0:F" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
74-
74+
7575
# Rename back to original
7676
Rename-Item -Path $backupPath -NewName "$dll.dll" -ErrorAction SilentlyContinue
7777
Write-Host "Restored ${dll}_BAK.dll to $dll.dll"
78-
78+
7979
# Restore ownership to TrustedInstaller
8080
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$dllPath`" /setowner `"NT SERVICE\TrustedInstaller`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
8181
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$dllPath`" /remove *S-1-1-0" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
@@ -88,7 +88,7 @@ function Invoke-WPFUpdatesdefault {
8888

8989
# Enable update related scheduled tasks
9090
Write-Host "Enabling update related scheduled tasks..." -ForegroundColor Yellow
91-
91+
9292
$taskPaths = @(
9393
'\Microsoft\Windows\InstallService\*'
9494
'\Microsoft\Windows\UpdateOrchestrator\*'
@@ -124,7 +124,7 @@ function Invoke-WPFUpdatesdefault {
124124
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "BranchReadinessLevel" -ErrorAction SilentlyContinue
125125
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferFeatureUpdatesPeriodInDays" -ErrorAction SilentlyContinue
126126
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferQualityUpdatesPeriodInDays" -ErrorAction SilentlyContinue
127-
127+
128128
Write-Host "==================================================="
129129
Write-Host "--- Windows Update Settings Reset to Default ---"
130130
Write-Host "==================================================="
@@ -148,6 +148,6 @@ function Invoke-WPFUpdatesdefault {
148148
Write-Host "==================================================="
149149
Write-Host "--- Windows Local Policies Reset to Default ---"
150150
Write-Host "==================================================="
151-
151+
152152
Write-Host "Note: A system restart may be required for all changes to take full effect." -ForegroundColor Yellow
153153
}

functions/public/Invoke-WPFUpdatesdisable.ps1

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ function Invoke-WPFUpdatesdisable {
99
This function requires administrator privileges and will attempt to run as SYSTEM for certain operations.
1010
1111
#>
12-
12+
1313
Write-Host "Configuring registry settings..." -ForegroundColor Yellow
14-
14+
1515
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
1616
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
1717
}
1818
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 1
1919
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 1
20-
20+
2121
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config")) {
2222
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Force | Out-Null
2323
}
2424
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 0
25-
25+
2626
# Additional registry settings
2727
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc" -Name "Start" -Type DWord -Value 4 -ErrorAction SilentlyContinue
2828
$failureActions = [byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xd4,0x01,0x00,0x00,0x00,0x00,0x00,0xe0,0x93,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00)
2929
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc" -Name "FailureActions" -Type Binary -Value $failureActions -ErrorAction SilentlyContinue
3030

3131
# Disable and stop update related services
3232
Write-Host "Disabling update services..." -ForegroundColor Yellow
33-
33+
3434
$services = @(
3535
"BITS"
3636
"wuauserv"
@@ -46,7 +46,7 @@ function Invoke-WPFUpdatesdisable {
4646
if ($serviceObj) {
4747
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
4848
Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
49-
49+
5050
# Set failure actions to nothing using sc command
5151
Start-Process -FilePath "sc.exe" -ArgumentList "failure `"$service`" reset= 0 actions= `"`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
5252
}
@@ -58,26 +58,26 @@ function Invoke-WPFUpdatesdisable {
5858

5959
# Rename critical update service DLLs (requires SYSTEM privileges)
6060
Write-Host "Attempting to rename critical update service DLLs..." -ForegroundColor Yellow
61-
61+
6262
$dlls = @("WaaSMedicSvc", "wuaueng")
63-
63+
6464
foreach ($dll in $dlls) {
6565
$dllPath = "C:\Windows\System32\$dll.dll"
6666
$backupPath = "C:\Windows\System32\${dll}_BAK.dll"
67-
67+
6868
if (Test-Path $dllPath) {
6969
try {
7070
# Take ownership
7171
Start-Process -FilePath "takeown.exe" -ArgumentList "/f `"$dllPath`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
72-
72+
7373
# Grant full control to everyone
7474
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$dllPath`" /grant *S-1-1-0:F" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
75-
75+
7676
# Rename file
7777
if (!(Test-Path $backupPath)) {
7878
Rename-Item -Path $dllPath -NewName "${dll}_BAK.dll" -ErrorAction SilentlyContinue
7979
Write-Host "Renamed $dll.dll to ${dll}_BAK.dll"
80-
80+
8181
# Restore ownership to TrustedInstaller
8282
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$backupPath`" /setowner `"NT SERVICE\TrustedInstaller`"" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
8383
Start-Process -FilePath "icacls.exe" -ArgumentList "`"$backupPath`" /remove *S-1-1-0" -Wait -WindowStyle Hidden -ErrorAction SilentlyContinue
@@ -91,7 +91,7 @@ function Invoke-WPFUpdatesdisable {
9191

9292
# Delete downloaded update files
9393
Write-Host "Cleaning up downloaded update files..." -ForegroundColor Yellow
94-
94+
9595
try {
9696
$softwareDistPath = "C:\Windows\SoftwareDistribution"
9797
if (Test-Path $softwareDistPath) {
@@ -105,7 +105,7 @@ function Invoke-WPFUpdatesdisable {
105105

106106
# Disable update related scheduled tasks
107107
Write-Host "Disabling update related scheduled tasks..." -ForegroundColor Yellow
108-
108+
109109
$taskPaths = @(
110110
'\Microsoft\Windows\InstallService\*'
111111
'\Microsoft\Windows\UpdateOrchestrator\*'
@@ -129,7 +129,7 @@ function Invoke-WPFUpdatesdisable {
129129
}
130130

131131
Write-Host "=================================" -ForegroundColor Green
132-
Write-Host "--- Updates ARE DISABLED ---" -ForegroundColor Green
132+
Write-Host "--- Updates ARE DISABLED ---" -ForegroundColor Green
133133
Write-Host "===================================" -ForegroundColor Green
134134
Write-Host "Note: Some operations may require a system restart to take full effect." -ForegroundColor Yellow
135135
}

0 commit comments

Comments
 (0)