Cleanup Cache for a failing Deployment

(Last updated on August 2, 2018)

This is a quite specific scenario which quite few companies may run into. A company is using their own Wrapper-Script for all installations and ran into some problems where all files did not exist in the Deploy Cache.
Which caused failed installations (missing files etc).

To reset the deployment on a client, clean up the DeployCache and make the client download all the files again run this script;

Echo off  
echo %date% %time% > c:tempclean.txt  
Echo Executing user: >> c:tempclean.txt 
whoami >> c:tempclean.txt    

if exist c:tempprogress.txt del c:tempprogress.txt 
reg query "HKLMSOFTWARESpecopsSoftSpecops DeployClient Side ExtensionDownload Cache" /s /v Progress | findstr /c:HKEY > c:tempprogress.txt  
if not exist c:tempprogress.txt goto noprog    

setlocal enabledelayedexpansion  

for /F "Delims= Tokens=1-20" %%a in (c:tempprogress.txt) do ( 
dir "C:WindowsSpecopsDeployDownloadCache%%g" >> c:tempclean.txt 
reg query "HKLMSOFTWARESpecopsSoftSpecops DeployClient Side ExtensionDownload Cache" /s /v Progress >> c:tempclean.txt   

echo.  Echo Clean starts >> c:tempClean.txt  
rmdir /Q /S "C:WindowsSpecopsDeployDownloadCache%%g"  

echo reg delete "HKLMSOFTWARESpecopsSoftSpecops DeployClient Side ExtensionDownload Cache%%g" /VA /F >> c:tempclean.txt 
reg delete "HKLMSOFTWARESpecopsSoftSpecops DeployClient Side ExtensionDownload Cache%%g" /VA /F 
reg delete "HKLMSOFTWARESpecopsSoftSpecops DeployClient Side ExtensionDownload Cache%%g" /F  

echo.  
Echo Clean Done >> c:tempClean.txt  
Echo. 
Echo Showing remaining dirs in DownloadCache >> c:tempclean.txt  
dir "C:WindowsSpecopsDeployDownloadCache" >> c:tempclean.txt 
Echo. 
Echo.  
Echo Showing remaining RegKeys with Progress: >> c:tempclean.txt  
reg query "HKLMSOFTWARESpecopsSoftSpecops DeployClient Side ExtensionDownload Cache" /s /v Progress >> c:tempclean.txt   
)   

if exist c:tempprogress.txt del c:tempprogress.txt 
goto end  

:noprog 
Echo Nothing to do. >> c:tempclean.txt  

:end 
# End of Script

It’s quite easy to copy the script to the PC and then execute the script with either Sysinternals PSExec or with Specops GpUpdate Pro.

Back to Blog