AddRange Method of the IFPCTunnelPortRanges Interface

The AddRange method creates a new FPCTunnelPortRange object in the collection and returns a reference to it.

C++

Syntax

HRESULT AddRange(
  [in]   BSTR bstrName,
  [in]   long lLowPort,
  [in]   long lHighPort,
  [out]  IFPCTunnelPortRange** ppNewDest
);

Parameters

  • bstrName
    Required. String value that specifies the name of the new tunnel port range.

  • lLowPort
    Required. A 32-bit integer that specifies the low end of the port range. The range of permissible values is from 1 through 65535.

  • lHighPort
    Required. A 32-bit integer that specifies the high end of the port range. The range of permissible values is from 1 through 65535.

  • ppNewDest
    Address of an interface pointer that on return points to the new IFPCTunnelPortRange interface created.

Return Value

This method can return one of the following:

  • S_OK, indicating that the operation succeeded.
  • An error code, indicating that the operation failed. In this case, the [out] parameter returned is a null object.

Visual Basic

Syntax

Function AddRange( _
  ByVal bstrName As String, _
  ByVal lLowPort As Long, _
  ByVal lHighPort As Long _
) As FPCTunnelPortRange

Parameters

  • bstrName
    Required. String value that specifies the name of the new tunnel port range.

  • lLowPort
    Required. A 32-bit integer that specifies the low end of the port range. The range of permissible values is from 1 through 65535.

  • lHighPort
    Required. A 32-bit integer that specifies the high end of the port range. The range of permissible values is from 1 through 65535.

Return Value

This method returns a reference to an FPCTunnelPortRange object if successful. Otherwise, an error is raised that can be intercepted by using an error handler.

Example Code

The following VBScript code shows how to create a new tunnel port range consisting of a single port.

' Define the constants needed.
Const NewRangeName = "SSL 3520"
Const NewRangePort = "3520"
' Create the root object.
Dim root  ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")
'Declare the other objects needed.
Dim isaArray     ' a Forefront TMG array object
Dim tpRanges     ' An FPCTunnelPortRanges collection
Dim newRange     ' An FPCTunnelPortRange object
' Get a reference to the array and to
' the collection of tunnel port ranges.
Set isaArray = root.GetContainingArray()
Set tpRanges = isaArray.ArrayPolicy.WebProxy.TunnelPortRanges
' Create a new tunnel port range.
Set newRange = tpRanges.AddRange(NewRangeName, NewRangePort, NewRangePort)
' Save the changes to the collection of tunnel port ranges
' with fResetRequiredServices set to True to restart the Firewall service.
tpRanges.Save True

Remarks

After the FPCTunnelPortRange collection is modified by calling this method, the changes must be written to persistent storage by calling the Save method, and the Microsoft Firewall service must be restarted for the changes to take effect. For more information about restarting the Firewall service to apply changes, see Restarting Services After Configuration Changes.

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

FPCTunnelPortRanges

Send comments about this topic to Microsoft

Build date: 6/30/2010