Created
July 27, 2018 02:37
-
-
Save yon2004/6193a168cd9fde7aed9f16942f02efd4 to your computer and use it in GitHub Desktop.
A script that can be run to fix the windows 10 bug that causes corruption of the software distribution folder. 0x80242006
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$log_path = "$($env:TEMP)\WindowsUpdateFix.txt" | |
$folder_name = "$($env:windir)\SoftwareDistribution" | |
$folder_name_new = "$($env:windir)\SoftwareDistribution.27072018" | |
Start-Transcript -Path $log_path -Append | |
Write-Output "log_path: $($log_path)" | |
Write-Output "folder_name: $($folder_name)" | |
Write-Output "folder_name_new: $($folder_name_new)" | |
If(Test-Path -Path $folder_name_new){ | |
Write-Output "$($folder_name_new) already exists stopping WindowsUpdateFix" | |
} else { | |
Get-Service @('wuauserv') | Set-Service -StartupType Disabled -Verbose | |
Get-Service @('bits','appidsvc', 'cryptsvc', 'wuauserv') |Stop-Service -Force -Verbose | |
Move-Item -Path $folder_name -Destination $folder_name_new -Verbose -Force | |
Get-Service @('wuauserv') | Set-Service -StartupType Manual -Verbose | |
Get-Service @('bits','appidsvc', 'cryptsvc', 'wuauserv') |Start-Service -Verbose | |
} | |
Stop-Transcript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
powershell.exe -ExecutionPolicy Bypass -File .\WindowsUpdateFix.ps1