Disclaimer / Clause de non-responsabilité / Haftungsausschluss:
Use of the code examples is at your own risk!
L’utilisation des exemples de code s’effectue à vos propres risques et périls !
Die Nutzung der Codebeispiele erfolgt auf eigenes Risiko!
Microsoft links on the topic:
Clear-Host
Write-Host "*-*"
# Windows Update Cache Cleanup Script - Run as Administrator
Write-Host "Bereinige Windows Update Cache..." -ForegroundColor Cyan
# Stop Windows Update services
Write-Host "Stop services..."
Stop-Service -Name wuauserv -Force
Stop-Service -Name bits -Force
Stop-Service -Name cryptsvc -Force
Stop-Service -Name msiserver -Force
# Delete the contents of the cache folders
$folders = @(
"$env:SystemRoot\SoftwareDistribution\Download",
"$env:SystemRoot\SoftwareDistribution\DataStore",
"$env:SystemRoot\System32\catroot2"
)
foreach ($folder in $folders) {
Write-Host "Lösche Inhalt von: $folder"
Remove-Item "$folder\*" -Recurse -Force -ErrorAction SilentlyContinue
}
# Restart the services
Write-Host "Starte Dienste..."
Start-Service -Name wuauserv
Start-Service -Name bits
Start-Service -Name cryptsvc
Start-Service -Name msiserver
Write-Host "Cleanup completed!" -ForegroundColor Green