CreateHTTPAllowRule.vbs


The following script creates a new access rule that allows HTTP traffic from the internal network to the external network. You can use this as the foundation to create scripts that create other access rules with different protocols.

 '==================================================================== ' ' PURPOSE: Create an HTTP Allow rule on ISA Server 2004 ' ' NAME: CreateHTTPAllowRule.vbs ' ' RUN: cscript CreateHTTPAllowRule.vbs ' ' WHERE: Run on an ISA Server 2004, Local on Server ' ' COMMENT: This script was written by Jesper Hanno Hansen. ' ' VERSION: 1.0 '==================================================================== ' Set FPCInclude from FPCIncludeStatus Const FPCInclude = 0 ' Set FPCPolicyRuleActionAllow from FPCPolicyRuleActions Const FPCPolicyRuleActionAllow = 0 ' Set FPCSpecifiedProtocols from FpcProtocolSelectionType Const FPCSpecifiedProtocols = 1 ' Create a Root Object to ISA Server 2004 Dim objRoot Set objRoot = CreateObject("FPC.Root") ' Create an FPCArray Object to retrieve the current ISA Array Dim objFPCArray Set objFPCArray = objRoot.GetContainingArray ' Create an FPCArrayPolicy Object to get access to FPCPolicyRules Dim objFPCArrayPolicy Set objFPCArrayPolicy = objFPCArray.ArrayPolicy ' Create an FPCPolicyRules Object to get access to FPCPolicyRule Dim objFPCPolicyRules Set objFPCPolicyRules = objFPCArrayPolicy.PolicyRules ' Using the AddAccessRule method from the FPCPolicyRules Object ' and returns a reference to it. ' The AddAccessRule method requires one parameter, a Name (String Value) Dim objFPCPolicyRule Set objFPCPolicyRule = objFPCPolicyRules.AddAccessRule("Allow HTTP" & _                      " from Internal to External") ' Set Action Property to Allow from the FPCPolicyRuleActionAllow Constant objFPCPolicyRule.Action = FPCPolicyRuleActionAllow ' Set Description Property to Allow Internet Access objFPCPolicyRule.Description = "Allow Internet Access" ' Set Enabled to True so the Rule is Enabled objFPCPolicyRule.Enabled = True ' Using the Add method from the FPCRef object via the Network ' FPCRefs collection object via FPCSelectionIPs  ' The Add method requires 2 input parameters, Name and IncludeStatus objFPCPolicyRule.SourceSelectionIPs.Networks.Add "Internal", FPCInclude ' Using the Add method from the FPCRef object via the Network ' FPCRefs collection object via FPCSelectionIPs and FPCAccessProperties ' The Add method requires 2 input parameters, Name and IncludeStatus objFPCPolicyRule.AccessProperties.DestinationSelectionIPs.Networks.add _ "External", FPCInclude ' Using the Add method from the FPCRef object via the FPCProtocolDefinition ' FPCRefs collection object via FPCAccessProperties. ' The Add method requires 2 input parameters, Name and IncludeStatus objFPCPolicyRule.AccessProperties.SpecifiedProtocols.Add "HTTP", FPCInclude ' Set ProtocolSelectionMethod to the FPCRefs Object FPCSpecifiedProtocols '(HTTP) objFPCPolicyRule.AccessProperties.ProtocolSelectionMethod = _ FPCSpecifiedProtocols ' Using the Add method from the FPCRef object via the FPCUserSet ' FPCRefs collection object via FPCAccessProperties. ' The Add method requires 2 input parameters, Name and IncludeStatus objFPCPolicyRule.AccessProperties.UserSets.Add "All Users", FPCInclude ' Save all values to the new rule, and committing changes objFPCPolicyRules.save ' Using Wscript.echo to show information on the screen that the script ' completed  WScript.Echo "New rule created" 




Microsoft Internet Security and Acceleration ISA Server 2004 Administrator's Pocket Consultant
Microsoft Internet Security and Acceleration (ISA) Server 2004 Administrators Pocket Consultant (Pro-Administrators Pocket Consultant)
ISBN: 0735621888
EAN: 2147483647
Year: 2006
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net