Please use the script to clean the windows update folder
Please run the script as System User
Steps:
- Stop Windows Update service and BITS.
 - Rename the SoftwareDistribution Folder
 - Restart the Windows Update and BITS services.
 - Check that a new SoftwareDistribution folder has been created.
 - Delete the renamed folder
 
def ecmd(CMD):
    import ctypes
    class disable_file_system_redirection:
        _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
        _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
        def __enter__(self):
            self.old_value = ctypes.c_long()
            self.success = self._disable(ctypes.byref(self.old_value))
        def __exit__(self, type, value, traceback):
            if self.success:
                self._revert(self.old_value)
    from subprocess import PIPE, Popen
    with disable_file_system_redirection():
        OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
    out, err = OBJ.communicate()
    ret=OBJ.returncode
    return ret
import os
import shutil
import random
n=random.randint(10000, 20000)
p='C:\\Windows\\SoftwareDistribution'
rn='ren "%s" "%s"'%(p, n)
pn='C:\\Windows\\%s'%n
print 'Stopping Windows Update Service %s %s'%('.'*20, ecmd('net stop wuauserv')==0)
print 'Disabling Windows Update Service %s %s'%('.'*20, ecmd('sc config wuauserv start= disabled')==0)
##print 'Stopping BITS %s %s'%('.'*20, ecmd('net stop BITS')==0)
print 'Disabling BITS %s %s'%('.'*20, ecmd('sc config BITS start= disabled')==0)
print 'Renaming SoftwareDistribution %s %s'%('.'*20, ecmd(rn)==0)
print 'Enabling Windows Update Service %s %s'%('.'*20, ecmd('sc config wuauserv start= auto')==0)
print 'Starting Windows Update Service %s %s'%('.'*20, ecmd('net start wuauserv')==0)
print 'Enabling BITS %s %s'%('.'*20, ecmd('sc config BITS start= auto')==0)
print 'Starting BITS %s %s'%('.'*20, ecmd('net start BITS')==0)
if os.path.isdir(p):
    print '%s %s is available again'%(p, '.'*20)
else:
    print '%s %s is not available again!!'%(p, '.'*20)
if os.path.isdir(pn):
    shutil.rmtree(pn)
    print 'Removing the renamed Folder %s %s True'%(pn, '.'*20)
else:
    print 'Removing the renamed Folder %s %s False'%(pn, '.'*20)
Sample Output:
Script in JSON format:
20170530-Clean-Windows-Update-Folder.json
