This VBScript example creates a new FPCConnectivityVerifier object in the FPCConnectivityVerifiers collection of the Forefront TMG 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 Forefront TMG Software Development Kit (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
The following code can be saved to a .vbs file and run from a command prompt on a computer running Forefront TMG 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 tmgArray ' 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 tmgArray = root.GetContainingArray() Set verifiers = tmgArray.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
Send comments about this topic to Microsoft
Build date: 11/30/2009
© 2008 Microsoft Corporation. All rights reserved.