Jump to content


mohanad

What is the best way to Clear CCM Cache?

Recommended Posts

I am trying to find a best way to clear the ccm cash folder , i found some script to do that, but i want to share it with you,any idea?

 

------------------------------------------------------

Dim objFSO
Dim objFolder
Dim objSubFolder
Dim winsh
Dim winenv

'deletes folders with a date modified of 120 day or older
Const intDaysOld = 120
set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WINDIR")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'looks for \system32\ccm\cache for 32bit
if objFSO.FolderExists (windir & "\system32\ccm\cache") Then
Set objFolder = objFSO.GetFolder(windir & "\system32\ccm\cache")
For Each objSubFolder In objFolder.SubFolders
If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then
objSubFolder.Delete True
End If
Next
Wscript.quit
End if
'looks for \sysWOW64\ccm\cache for 64bit
if objFSO.FolderExists (windir & "\sysWOW64\ccm\cache") Then
Set objFolder = objFSO.GetFolder(windir & "\sysWOW64\ccm\cache")
For Each objSubFolder In objFolder.SubFolders
If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then
objSubFolder.Delete True
End If
Next
End if

-------------------------------------------------

 

Thanks in advance

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.