ken_chiro11
New Member
- Messages
- 2
- Reaction score
- 0
- Points
- 1
Hi Sccm team
I research and modifly Script Clean Folder ccmcache old 30 Day
How to run from sccm when client Status is online (Check everyday when client online)?
This Script .Vbs >>
Dim objFSO
Dim objFolder
Dim objSubFolder
Dim winsh
Dim winenv
'deletes folders with a date modified of 30 day or older
Const intDaysOld = 30
set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WINDIR")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'looks for c:\Windows\ccmcache for 32bit
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
Wscript.quit
End if
'looks for c:\Windows\ccmcache for 64bit
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
Thanks
I research and modifly Script Clean Folder ccmcache old 30 Day
How to run from sccm when client Status is online (Check everyday when client online)?
This Script .Vbs >>
Dim objFSO
Dim objFolder
Dim objSubFolder
Dim winsh
Dim winenv
'deletes folders with a date modified of 30 day or older
Const intDaysOld = 30
set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WINDIR")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'looks for c:\Windows\ccmcache for 32bit
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
Wscript.quit
End if
'looks for c:\Windows\ccmcache for 64bit
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
Thanks