Deleting Cache Contents
|
Microsoft® Internet Security and Acceleration (ISA) Server stores cached content in a cache content file, which is named Dir1.cdat and resides in the Urlcache folder on each drive that is configured for caching. A cache content file (.cdat file) is created when a drive is configured for caching. In addition, each time that the Microsoft Firewall service is started, it verifies that a cache content file is present on each drive that is configured for caching and automatically creates a new cache content file if the file has been deleted. The cached content stored in these files can be deleted manually by deleting all the cache content files and restarting the Firewall service. The Microsoft Visual Basic® Scripting Edition (VBScript) code in DeleteCacheContents.vbs (listed below) performs these steps programmatically and deletes all of the content stored in the ISA Server cache by replacing the cache content files stored on all the cache drives that are configured on the local ISA Server computer with new cache content files.
To delete cache contents
1. |
Create an instance of the FPC COM object, which provides access to the other ISA Server administration COM objects. |
2. |
Declare an FPCServer object, an FPCCacheDrives collection, an FPCCacheDrive object, and a FileSystemObject object. |
3. |
Get references to the existing FPCServer object and FPCCacheDrives collection. |
4. |
Call the StopFirewallService method of the server object to stop the Microsoft Firewall service. |
5. |
Create an instance of the FileSystemObject object. |
6. |
In a For loop, iterate the drives in the cache drives collection. For each drive, compose the path to the file Dir1.cdat in the Urlcache folder on each drive and call the DeleteFile method of the file system object to delete the file. |
7. |
Call the StartFirewallService method of the server object to start the Firewall service and create a new cache content file on each cache drive. |
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 objectSet root = CreateObject("FPC.Root")'Declare the other objects needed.Dim server' An FPCServer objectDim cacheDrives ' An FPCCacheDrives collectionDim cacheDrive' An FPCCacheDrive objectDim fso ' A file system objectSet server = root.GetContainingServer()server.StopFirewallService()Set cacheDrives = server.CacheDrivesSet fso = CreateObject("Scripting.FileSystemObject")For Each cacheDrive In cacheDrivescacheFilePath = CacheDrive.Name & "urlcacheDir1.cdat"fso.DeleteFile cacheFilePathNextserver.StartFirewallService()WScript.Echo "All the cache content files have been replaced by new files!"End SubDeleteCacheContents
Source