-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathFixStuckWindowsUpdate.ps1
More file actions
21 lines (14 loc) · 885 Bytes
/
FixStuckWindowsUpdate.ps1
File metadata and controls
21 lines (14 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Write-Output "[*] Stopping services that use the directories we need renamed"
Stop-Service -Name wuauserv,cryptsvc,bits,msiserver
Write-Output "[*] Renaming C:\Windows\SoftwareDistribution to SoftwareDistribution.bak"
If (Test-Path -Path "C:\Windows\SoftwareDistribution.bak") {
Remove-Item -Path "C:\Windows\SoftwareDistribution.bak" -Force
} # End If
Rename-Item -Path "C:\Windows\SoftwareDistribution" -NewName "C:\Windows\SoftwareDistribution.bak"
Write-Output "[*] Renaming C:\Windows\System32\catroot2 to catroot2.bak"
If (Test-Path -Path "C:\Windows\System32\catroot2.bak") {
Remove-Item -Path "C:\Windows\System32\catroot2.bak" -Force
} # End If
Rename-Item -Path "C:\Windows\System32\catroot2" -NewName "C:\Windows\System32\catroot2.bak"
Write-Output "[*] A restart is required to load the changes. Update Windows After the restart"
Restart-Computer -Confirm