Question from Community : When client downloaded a package into the cache and is removed from the collection with the advertisement will the content stay in the cache? Then if you put the client back into the collection later will it download the package or will is run from the cache if the content stays?
Configuration manager will not clean up the content from the cache, files will be available and usable. Content is not specific to any advertisements OR collection memberships. Clients simply require the content and a version of that content; if it's already in the client cache, it just uses it else it will download and run.
For more information about how sccm client cache works refer http://support.microsoft.com/kb/839513
Here is the script (from Shane Alexander) with little changes that works on both X86 and X64 OS looks into cache folder with folder name like x-x-x-x.1.System (X is random digits) and pipes the folder names to cache.txt file and remove each folder by reading one by one.
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")
'Delete all software update caches
If objFSO.FolderExists("C:\Windows\System32\ccm\cache") Then
objShell.Run ("cmd /c dir /b c:\windows\system32\ccm\cache\*-*-*-*-*.1.System>c:\temp\caches.txt")else
objShell.Run ("cmd /c dir /b c:\windows\syswow64\ccm\cache\*-*-*-*-*.1.System>c:\temp\caches.txt")
End If
If objFSO.FileExists ("C:\temp\caches.txt") Then
Set objFile = objFSO.OpenTextFile("C:\temp\caches.txt", 1)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
'Wscript.Echo strLine
dirPath = "c:\windows\system32\ccm\cache\" & strLine
'Wscript.Echo dirPath
objFSO.DeleteFolder dirPath, True
Wscript.Sleep 10
Loop
objFile.Close
End If
Wscript.Quit(0)
You can also power shell script to do this activity ,for more info please refer http://www.myitforum.com/absolutenm/templates/Articles.aspx?articleid=18962&zoneid=89
3 Comments
works fine for 64bit just amend the sccm cache location in the script
The way your script sites today, it will only work on 32-bit systems. You need a few more lines for it to work on 64-bit system with the syswow folder.
Hi Adam,
that was for 2007 and yes,for 64bit,i missed to add it ,and for cm12 ,location of ccmcache is C:\windows\ccmcache irrespective of Architecture (32 or 64) ,I will try to update the script that works for CM12 environment.
Thanks for notifying on this.