HRESULT get_URLSets( IFPCRef** ppRefs );
Address of a variable that receives a pointer to an IFPCRefs interface that represents the collection of references to the URL sets included in or excluded from the destinations to which the rule applies.
This property method returns S_OK if the call is successful; otherwise, it returns an error code.
Property URLSets As FPCRefs
Reference to an FPCRefs collection that contains references to the URL sets included in or excluded from the destinations to which the rule applies.
Option Explicit 'Define the constants needed Const Error_FileNotFound = &H80070002 Const Error_AlreadyExists = &H800700B7 Const fpcPolicyRuleAccess = 0 Const fpcInclude = 0 Main(WScript.Arguments) Sub Main(args) If(2 <> args.Count) Then Usage() End If AddUrlSetToAccessRule args(0), args(1) End Sub Sub AddUrlSetToAccessRule(ruleName, urlSetName) ' Create the root object. Dim root ' The FPCLib.FPC root object Set root = CreateObject("FPC.Root") 'Declare the other objects needed. Dim isaArray ' An FPCArray object Dim rules ' An FPCPolicyRules collection Dim rule ' An FPCPolicyRule object Dim urlSets ' An FPCURLSets colection Dim urlSet ' An FPCURLSet object ' Get references to the array object, the policy rules collection, ' and the URL sets collection. Set isaArray = root.GetContainingArray() Set rules = isaArray.ArrayPolicy.PolicyRules Set urlSets = isaArray.RuleElements.URLSets ' Retrieve the specified policy rule. On Error Resume Next Set rule = rules.Item(ruleName) If err.Number = Error_FileNotFound Then WScript.Echo "The access rule " & ruleName & " could not be found." WScript.Quit End If Err.Clear On Error GoTo 0 ' Verify that the specified rule is an access rule. If rule.Type <> fpcPolicyRuleAccess Then WScript.Echo "The " & ruleName & " policy rule is not an access rule." WScript.Quit End If ' Verify that the specified URL set exists. On Error Resume Next Set urlSet = urlSets.Item(urlSetName) If err.Number = Error_FileNotFound Then WScript.Echo "The URL set " & urlSetName & " could not be found." WScript.Quit End If Err.Clear On Error GoTo 0 ' Add the specified URL set to the destinations specified as URL sets ' to which the rule applies. On Error Resume Next rule.AccessProperties.URLSets.Add urlSetName, fpcInclude If err.Number = Error_AlreadyExists Then WScript.Echo "The URL set " & urlSetName & " is already referenced " _ & "by the access rule." WScript.Quit End If Err.Clear On Error GoTo 0 ' Save the changes to the access rule. rule.Save WScript.Echo "Done!" End Sub Sub Usage() WScript.Echo "Usage:" & VbCrLf _ & " " & WScript.ScriptName & " URLSetName RuleName" & VbCrLf _ & "" & VbCrLf _ & " RuleName - Access rule which will use the URLset" & VbCrLf _ & " URLSetName - URL set for specifying destinations" WScript.Quit End Sub
This property is read-only. It can be modified by calling the methods of the FPCRefs collection retrieved (the IFPCRefs interface retrieved in C++).
The IncludeStatus property of each reference specifies whether the URL set referenced is included in or excluded from the destinations to which the rule applies.
|Client||Requires Windows Vista or Windows XP.|
|Server||Requires Windows Server 2008.|
|Version||Requires Forefront Threat Management Gateway (TMG).|
Declared in Msfpccom.idl.
Build date: 11/30/2009
© 2008 Microsoft Corporation. All rights reserved.[an error occurred while processing this directive]