注册
 找回密码
 注册
江西广告网
查看: 262|回复: 0
打印 上一主题 下一主题

ISA脚本技术:删除缓存内容

[复制链接]

该用户从未签到

1
跳转到指定楼层
发表于 2008-12-28 12:28:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册

x
  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       <
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表