
Script Listing: DeleteCacheContents.vbs
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This script deletes all of the content stored in the ISA Server cache by
' deleting the cache content files stored on all the cache drives that are
' configured on the local ISA Server computer and then restarting the Firewall
' service, which creates new cache content files.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub DeleteCacheContents()
' Create the root obect.
Dim root ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")
'Declare the other objects needed.
Dim server ' An FPCServer object
Dim cacheDrives ' An FPCCacheDrives collection
Dim cacheDrive ' An FPCCacheDrive object
Dim fso ' A file system object
Set server = root.GetContainingServer()
server.StopFirewallService()
Set cacheDrives = server.CacheDrives
Set fso = CreateObject("Scripting.FileSystemObject")
For Each cacheDrive In cacheDrives
cacheFilePath = CacheDrive.Name & "\urlcache\Dir1.cdat"
fso.DeleteFile cacheFilePath
Next
server.StartFirewallService()
WScript.Echo "All the cache content files have been replaced by new files!"
End Sub
DeleteCacheContents
For a tool that you can use to view real-time cache contents, save cache content to a file, and mark obsolete items that should not be served from the cache, see