鸿 网 互 联 www.68idc.cn

ISA脚本技术:创建策略规则报告

来源:互联网 作者:佚名 时间:2015-06-04 21:24
在 ISA Server 中 可以通过检索代表策略规则的对象的属性来创建包含策略规则信息的报告 PolicyRulesReport vbs 中的 Microsoft Visual Basic Scripting Edition (VBScript) 代码可以检索系统策略规则集合和策略规则集合 循环访问这些集合 并生成一个报告 该

  在 ISA Server 可以通过检索代表策略规则的对象的属性来创建包含策略规则信息的报告PolicyRulesReportvbs 中的 Microsoft Visual Basic Scripting Edition (VBScript) 代码可以检索系统策略规则集合和策略规则集合循环访问这些集合并生成一个报告该报告中将包含规则名称并将指示出各个规则是否已启用可以修改此脚本以生成一些包含这些规则的其他属性的报告
  
  用法
  Cscript PolicyRulesReportvbs(或双击执行)
  
  创建一个策略规则报告
  创建一个 FPC COM 对象实例此实例提供对其他 ISA 服务器管理 COM 对象的访问
  声明一个 FPCArray 对象﹑两个 FPCPolicyRules 集合和一个 FPCPolicyRule 对象
  获取对现有的 FPCArray 对象﹑系统策略规则的 FPCPolicyRules 集合和普通策略规则的FPCPolicyRules 集合的引用
  在一个 For 循环中循环访问系统策略规则集合中的对象对每个系统策略规则检索Enabled属性的值并显示规则的名称名称后紧跟一个表明此规则被启用还是被禁用的指示符
  在一个 For 循环中循环访问策略规则集合中的对象对每个策略规则检索 Enabled属性的值并显示规则的名称名称后紧跟一个表明此规则被启用还是被禁用的指示符
  PolicyRulesReportvbs的内容如下复制到记事本中另存为vbs扩展名即可
  
  =================================================================================
  
  
   Copyright (c) Microsoft Corporation All rights reserved
   THIS CODE IS MADE AVAILABLE AS IS WITHOUT WARRANTY OF ANY KIND THE ENTIRE
   RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE
   USER USE AND REDISTRIBUTION OF THIS CODE WITH OR WITHOUT MODIFICATION IS
   HEREBY PERMITTED
  
  
   This script retrieves the collection of system policy rules and the
   collection of policy rules and implicitly uses the _NewEnum property to
   iterate through the collections and display the names of the rules with
   an indication of whether each rule is enabled
  
  Sub IteratePolicyRules()
   Create the root obect
  Set root = CreateObject(FPCRoot)
   Declare the other objects needed
  Dim array An FPCArray object
  Dim spRules An FPCPolicyRules collection
  Dim rules An FPCPolicyRules collection
  Dim rule An FPCPolicyRule object
  Dim isEnabled A string
   Get references to the array object the system
   policy rules collection and the policy rules collection
  Set array = rootGetContainingArray()
  Set spRules = arraySystemPolicyPolicyRules
  Set rules = arrayArrayPolicyPolicyRules
   List the system policy rules and indicate whether each
   rule is enabled
  WScriptEcho ***System Policy Rules***
  For Each rule In spRules
  If ruleEnabled = True Then
  isEnabled = Enabled
  Else
  isEnabled = Disabled
  End If
  WScriptEcho ruleName & : & isEnabled
  Next
   List the policy rules and indicate whether each
   rule is enabled
  WScriptEcho vbCrLf & ***Policy Rules***
  For Each rule In rules
  If ruleEnabled = True Then
  isEnabled = Enabled
  Else
  isEnabled = Disabled
  End If
  WScriptEcho ruleName & : & isEnabled
  Next
  End Sub
  IteratePolicyRules
  
网友评论
<