Here’s a link to a powershell script.
Usual disclaimer: Use at your own risk. Check any scripts from the internet before running them.
Stop the Windows Update service (wuauserv).
stop-service wuauserv
Delete or rename C:\Windows\SoftwareDistribution
rename-item "C:\Windows\SoftwareDistribution" "C:\Windows\SoftwareDistributionOLD"
Start the Windows Update service (wuauserv). This will recreate the SoftwareDistribution directory.
start-service wuauserv
Run Windows Update to download a fresh copy of any updates.
control update