Cleaning SoftwareDistribution folder
Silent install package for Cleaning SoftwareDistribution folder
Package Function Description
This script is designed to reset the Windows Update mechanism on a Windows workstation. Specifically, it performs the following actions:
1 - Stops the Windows Update services (wuauserv), BITS (bits), and Cryptographic Services (cryptsvc)
2 - Completely deletes the C:\Windows\SoftwareDistribution folder in order to clean the update cache and fix potential corruption issues
3 - Restarts the same services so that Windows Update can function normally again and future updates can be detected more easily
4- Finally a DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase is ran
Use Cases
This script is particularly useful in the following situations:
- Repeated Windows Update failures
- Windows Update stuck or returning errors
- Need to start from a clean state for downloading Windows Updates on a workstation
- Windows updates remain in "Pending" status
This script can be automatically deployed via WAPT as part of a one-time corrective action on workstations. It runs immediately after installation; if needed, forcing the package reinstallation will execute it again.
- package: tis-clean-softwaredistribution
- name: Cleaning SoftwareDistribution folder
- version: 1-6
- categories: Security,System and network
- maintainer: WAPT Team,Tranquil IT,Joffrey Le Piquet
- locale: all
- target_os: windows
- architecture: all
- signature_date:
- size: 41.95 Ko
package : tis-clean-softwaredistribution
version : 1-6
architecture : all
section : base
priority : optional
name : Cleaning SoftwareDistribution folder
categories : Security,System and network
maintainer : WAPT Team,Tranquil IT,Joffrey Le Piquet
description :
depends :
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.0
sources :
installed_size :
impacted_process :
description_fr :
description_pl :
description_de :
description_es :
description_pt :
description_it :
description_nl :
description_ru :
audit_schedule :
editor :
keywords :
licence :
homepage :
package_uuid : 502561c7-10ce-4036-859c-758c5b1c66f2
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version :
max_os_version :
icon_sha256sum : b3224aa80cc54b54f8732c118ccff5a8968dec827100ff928d919ca0f4bdc8f3
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date : 2026-02-10T14:04:42.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature : GIYcspZDex+kdrvMc0e7j1yNr2KX9dAC4mTDjbmaMBIyPv4zoELErPRhRz5Qd1uFhMmErGlUXZ1NNp31gqM5gHMTVw5HafJCLbNGPUAclj7cyUhq1a7ggwsDiy1CPyliECO/5s07iRwzohOw7+NjC3wL/uSpukBdZvsNLWUkCC+NVxGJq3X1Z9QpMiwayrXsZjs5JcIAcXyHLikOjSkyeFiwtJtzpe1LVvTtqJvodRI/V0Tl87v2LwE+ciLARkLM5SbdLiVvis92fnjogV8UT7eMPjtY1DH+mG2e5fbAFEiywQJhTKCJXfLgGjS0QZQkbgO4aN8KIlm079mugUtkmg==
# -*- coding: utf-8 -*-
from setuphelpers import *
def install():
win_services_to_stop = ['wuauserv', 'bits', 'cryptsvc']
software_distrib_windows = makepath(systemdrive, 'windows', 'softwareDistribution')
for s in win_services_to_stop:
if service_is_running(s):
try:
service_stop(s)
except:
pass
if isdir(software_distrib_windows):
# To handle long path create by windows update...
shutil.rmtree('\\\\?\\' + software_distrib_windows)
for s in win_services_to_stop:
if service_is_stopped(s):
try:
service_start(s)
except:
pass
# All existing update packages can't be uninstalled after this command is completed, but this won't block the uninstallation of future update package
run('DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase', timeout=3600)
ec3372e983daa50bdd0eca24f999e241cc900c92b46bf0d563d836df79ea4574 : WAPT/README.md
5a75da750e4899c32adb07fdbe6c0a509daad55481230aa243b4f793cfa77ce3 : WAPT/README_fr.md
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
455d4e476544ebab7b6cee2d98b1a855b38c0ce07c2d0a3aba8a4147bb446655 : WAPT/control
b3224aa80cc54b54f8732c118ccff5a8968dec827100ff928d919ca0f4bdc8f3 : WAPT/icon.png
6a32a9849e7284d858dee7212f14d38224277213dfeaedbbd9594e619aafd7d0 : luti.json
1666a1f51afe90ff49304363093a53f650dd186c35b9e5991d90f39e08356415 : setup.py