Create vbs file with the below codes and create a package in SCCM and run the deployment in a schedule cycle.
Modify X value in Const intDaysOld = "x" for days. eg: 30 equal to 30 days
Dim objFSO
Dim objFolder
Dim objSubFolder
Dim winsh
Dim winenv
Const intDaysOld = 20
set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WINDIR")
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objFSO.FolderExists (windir & "\ccmcache") Then
Set objFolder = objFSO.GetFolder(windir & "\ccmcache")
For Each objSubFolder In objFolder.SubFolders
If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then
objSubFolder.Delete True
End If
Next
End if
No comments:
Post a Comment