Export (0) Print
Expand All

Adding a Connectivity Verifier

Internet Security and Acceleration Server 2004/2006 SDK

This VBScript example creates a new FPCConnectivityVerifier object in the FPCConnectivityVerifiers collection of the ISA Server computer. The script includes a single subprocedure, called AddConnectivityVerifier.

This example is included as the AddConnectivityVerifier.vbs script in the Samples\Admin folder of the ISA Server 2006 Software Development Kit (SDK) and the ISA Server 2004 SDK.

The following procedure lists the steps used to create a new connectivity verifier in the code example that follows.

To create a connectivity verifier

  1. Define values from the FpcConnectivityGroupType and FpcRequestType enumerations. For more information about using values defined in ISA Server enumerated types in scripts, see Using Enumerated Types in Scripts.
  2. Create an instance of the FPC COM object, which provides access to the other ISA Server administration COM objects.
  3. Declare an FPCArray object, an FPCConnectivityVerifiers collection, and an FPCConnectivityVerifier object.
  4. Get references to the existing FPCArray object and FPCConnectivityVerifiers collection.
  5. Verify whether an FPCConnectivityVerifier object named DNS Verifier already exists. If it exists, remove it.
  6. Call the Add method of the connectivity verifiers collection to create a new connectivity verifier object named DNS Verifier.
  7. Set the Description and GroupType properties of the new connectivity verifier.
  8. Call the SetConnectivityRequest method to set the server address and request type of the new connectivity verifier.
  9. Use the Threshold property of the new connectivity verifier to set the round-trip time threshold for verification operations to two seconds.
  10. Call the Save method on the connectivity verifiers collection to write the changes to the new connectivity verifier to persistent storage.

The following code can be saved to a .vbs file and run from a command prompt on a computer running ISA Server with the Microsoft Firewall service installed.

 Sub AddConnectivityVerifier()

    ' Define enumeration values.
    Const fpcGroupDNS = 2
    Const fpcPingRequest = 1
    Const serverAddress = "10.0.0.20"
    Const thresholdTime = 2000 ' 2 seconds

    ' 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 verifiers   ' An FPCConnectivityVerifiers collection
    Dim verifier    ' An FPCConnectivityVerifier object

    ' Get references to the array object and the connectivity verifiers collection. 
    Set isaArray = root.GetContainingArray()
    Set verifiers = isaArray.ConnectivityVerifiers

    ' If a connectivity verifier named DNS Verifier already exists, remove it.
    verifiers.Refresh
    On Error Resume Next
    Set verifier = verifiers.Item("DNS Verifier")
    If Err.Number = 0 Then
        WScript.Echo "DNS Verifier exists. Removing it ..."
        verifiers.Remove "DNS Verifier"
        verifiers.Save
    End If

    WScript.Echo "Creating a new connectivity verifier ..."
    Set verifier = verifiers.Add("DNS Verifier")

    ' Set the description of the new connectivity verifier.
    verifier.Description = "This connectivity verifier checks connectivity by pinging the DNS server."

    ' Set the type of servers with which connectivity is checked.
    verifier.GroupType = fpcGroupDNS

    ' Set the server address and request type for connectivity verification requests.
    verifier.SetConnectivityRequest serverAddress, fpcPingRequest

    ' Set the round-trip time threshold for verification operations
    verifier.Threshold = thresholdTime

    'Save the changes to the connectivity verifier.
    verifiers.Save
    WScript.Echo "Done!"
End Sub 

AddConnectivityVerifier
Show:
© 2014 Microsoft