''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright (c) Microsoft Corporation. All rights reserved.
' THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
' RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE
' USER. USE AND REDISTRIBUTION OF THIS CODE, WITH OR WITHOUT MODIFICATION, IS
' HEREBY PERMITTED.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This script sets the time, in seconds, that connectivity verifiers wait
' before rechecking connectivity by setting the RefreshRate property of the
' FPCConnectivityVerifiers collection to the value specified by the user. The
' value of this property is initially set to 30 seconds, and its range of
' permissible values is from 15 through 1440.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Main(WScript.Arguments)
Sub Main(args)
Dim newValue ' An Integer
If(args.Count <> 1) Then
Usage()
End If
On Error Resume Next
newValue = CInt(args(0))
If Err.Number <> 0 Then
WScript.Echo "The argument entered must be a number."
Else
On Error GoTo 0
If newValue >= 15 And newValue <= 1440 Then
SetConnectivityRefreshRate newValue
Else
WScript.Echo "The value specified must be between 15 and 1440."
End If
End If
End Sub
Sub SetConnectivityRefreshRate(newValue)
'Declare the objects needed.
Dim root ' The FPCLib.FPC root object
Dim isaArray ' An FPCArray object
Dim verifiers ' An FPCConnectivityVerifiers collection
' Create the root object.
Set root = CreateObject("FPC.Root")
' Get references to the array object
' and the connectivity verifiers collection.
Set isaArray = root.GetContainingArray()
Set verifiers = isaArray.ConnectivityVerifiers
' Change the value of the property if necessary.
WScript.Echo "Current refresh time: " & verifiers.RefreshRate
If newValue <> verifiers.RefreshRate Then
WScript.Echo "Setting the refresh time to " & newValue & "..."
verifiers.RefreshRate = newValue
verifiers.Save
WScript.Echo "Done!"
End If
End Sub
Sub Usage()
WScript.Echo "Usage:" & VbCrLf _
& " " & WScript.ScriptName & " RefreshTime" & VbCrLf _
& "" & VbCrLf _
& " RefreshTime - Connectivity refresh time to be set"
WScript.Quit
End Sub