Chinaunix首页 | 论坛 | 博客
  • 博客访问: 543916
  • 博文数量: 625
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 4745
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-17 15:46
文章分类

全部博文(625)

文章存档

2011年(1)

2008年(624)

我的朋友

分类:

2008-10-17 15:48:04


  ISA Server 2004将缓存内容在一个缓存内容文件中,此文件名为 Dir1.cdat,驻留在配置为用于缓存的每个驱动器的 Urlcache 文件夹中。将某一驱动器配置为用于缓存后,将创建一个缓存内容文件(.cdat 文件)。此外,每次启动 Microsoft 服务时,Microsoft 服务都会检查每个配置为用于缓存的驱动器上是否存在一个缓存内容文件。如果此文件已被删除,该服务会自动创建一个新的缓存内容文件。通过删除所有缓存内容文件并重新启动防火墙服务,可以手动删除在这些文件中的缓存内容。DeleteCacheContents.vbs 中的 Microsoft Visual Basic Scripting Edition (VBScript) 代码可以用编程方式执行这些步骤,并可以删除存储在ISA 缓存中的所有内容,方法是用新缓存内容文件替代在本地 ISA 计算机上配置的所有缓存驱动器上存储的缓存内容文件。
  
  用法:
  Cscript DeleteCacheContents.vbs(或双击执行)
  
  删除缓存内容
  1.创建一个 FPC COM 对象实例,此实例提供对其他 ISA 服务器管理 COM 对象的访问。
  
  2.声明一个 FPCServer 对象、一个 FPCCacheDrives 集合、一个 FPCCacheDrive 对象和一个FileSystemObject 对象。
  
  3.获取对现有的 FPCServer 对象和 FPCCacheDrives 集合的引用。
  
  4.调用服务器对象的 StopFirewallService 方法来停止 Microsoft 防火墙服务。
  
  5.创建 FileSystemObject 对象的一个实例。
  
  6.在一个 For 循环中,循环访问缓存驱动器集合中的驱动器。对每一个驱动器,为每个驱动器上的 Urlcache 文件夹中的 Dir1.cdat文件构建路径并调用文件系统对象的 DeleteFile 方法来删除此文件。
  
  7.调用服务器对象的 StartFirewallService 方法来启动防火墙服务并在每个缓存驱动器上创建新的缓存内容文件。
  
  DeleteCacheContents.vbs的内容如下,复制到记事本中另存为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
  
  
【责编:admin】
--------------------next---------------------

阅读(331) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~