SelectNetworkTemplateAndPolicy Method of the IFPCArray Interface
The SelectNetworkTemplateAndPolicy method sets a selected network template and default policy for the array.
C++
Syntax
HRESULT SelectNetworkTemplateAndPolicy(
[in] BSTR networkTemplate,
[in] BSTR defaultPolicy
);
Parameters
networkTemplate
String value that specifies the name of the network template to be used. This parameter must be set to the value held in the Name property of an FPCNetworkTemplate object that is defined in the array.defaultPolicy
String value that specifies the name of the default firewall policy to be used. This parameter must be set to the value held in the Name property of an FPCPolicyInTemplate object that is included in the collection of policies held in the PoliciesInTemplate property of the FPCNetworkTemplate object specified in the networkTemplate parameter.
Return Value
This method returns S_OK if the call is successful; otherwise, it returns an error code.
Visual Basic
Syntax
Sub SelectNetworkTemplateAndPolicy( _
ByVal networkTemplate As String, _
ByVal defaultPolicy As String _
)
Parameters
networkTemplate
String value that specifies the name of the network template to be used. This parameter must be set to the value held in the Name property of an FPCNetworkTemplate object that is defined in the array.defaultPolicy
String value that specifies the name of the default firewall policy to be used. This parameter must be set to the value held in the Name property of an FPCPolicyInTemplate object that is included in the collection of policies held in the PoliciesInTemplate property of the FPCNetworkTemplate object specified in the networkTemplate parameter.
Return Value
This method does not return a value.
Example Code
This VBScript script applies a network template and a default firewall policy. Note that the Save method does not need to be called to apply the changes.
' Specify the names of a network template
' and a default firewall policy as constants.
Const TemplateName = "Edge Firewall"
Const PolicyName = "Block all"
' Declare the other objects needed.
Dim root ' An FPC object
Dim isaArray ' An FPCArray object
' Create the root obect.
Set root = CreateObject("FPC.Root")
' Get a reference to the array object.
Set isaArray = root.GetContainingArray()
' Apply the specified network template and default firewall policy.
isaArray.SelectNetworkTemplateAndPolicy TemplateName, PolicyName
WScript.echo "The network template " & _
isaArray.NetworkTemplateUsed.Name & " was applied."
Remarks
This method sets the NetworkTemplateUsed property of the array.
This method deletes all existing networks, network rules, and policy rules (except system policy rules), and replaces them with the network topology and rules defined by the network template and default policy selected.
We recommend that you export your Forefront TMG configuration before calling this method.
Requirements
Client | Requires Windows 7 or Windows Vista. |
Server | Requires Windows Server 2008 R2 or Windows Server 2008 x64 Edition with SP2. |
Version | Requires Forefront Threat Management Gateway (TMG) 2010. |
IDL | Declared in Msfpccom.idl. |
DLL | Requires Msfpccom.dll. |
See Also
Send comments about this topic to Microsoft
Build date: 6/30/2010