-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResetWindowsUpdateRemediation.ps1
38 lines (34 loc) · 1.26 KB
/
ResetWindowsUpdateRemediation.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<#
Version: 1.0
Author:
- JOrgen Nilsson (ccmexec.com)
Script: ResetWindowsUpdateRemediation.ps1
Description:
Hint: This is a community script. There is no guarantee for this. Please check thoroughly before running.
Version 1.0: Init
Run as: Admin
Context: 64 Bit
#>
$DependentService = Get-Service -name cryptsvc -DependentServices |Where-Object status -eq Started
if ($DependentService) {Stop-Service $DependentService -Force}
Stop-Service -Name wuauserv
Stop-Service -Name cryptsvc -Force
Stop-Service -Name bits -Force
if (Test-Path $Env:Windir\SoftwareDistribution.bak) {
Remove-Item $Env:Windir\SoftwareDistribution.bak -Recurse -Force
Rename-Item -Path $Env:Windir\SoftwareDistribution -NewName SoftwareDistribution.bak
} else {
Rename-Item -Path $Env:Windir\SoftwareDistribution -NewName SoftwareDistribution.bak
}
if (Test-Path $Env:Windir\System32\catroot2.bak) {
Remove-Item $Env:Windir\System32\catroot2.bak -Recurse -Force
Rename-Item -Path $Env:Windir\System32\catroot2 -NewName catroot2.bak
} else {
Rename-Item -Path $Env:Windir\System32\catroot2 -NewName catroot2.bak
}
Start-Service -Name cryptsvc
Start-Service -Name bits
Start-Service -Name wuauserv
if ($DependentService) {Start-Service $DependentService}
wuauclt /updatenow
Exit 0