IFPCTunnelPortRanges::AddRange method

Applies to: desktop apps only

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


  [in]   BSTR bstrName,
  [in]   long lLowPort,
  [in]   long lHighPort,
  [out]  IFPCTunnelPortRange **ppNewDest
FPCTunnelPortRanges.AddRange( _
  ByVal bstrName As String, _
  ByVal lLowPort As Long, _
  ByVal lHighPort As Long, _
  ByRef ppNewDest As IFPCTunnelPortRange _
) As FPCTunnelPortRange


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

  • lLowPort [in]
    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 [in]
    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 [out]
    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.


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.


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.


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


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)


Forefront Threat Management Gateway (TMG) 2010





See also




Build date: 7/12/2010