'Define the constants needed.
Const strVpsGUID = "{143F5698-103B-12D4-FF34-1F34767DEABC}"
Const strVpsPropertyName = "AcceptIdleTimeout"
Const Error_FileNotFound = &H80070002
Set objArgs = wscript.Arguments
if objArgs.Count > 0 then
uAcceptIdleTimeout = objArgs(0)
end if
if objArgs.Count <> 1 then
wscript.echo "Usage: SetAcceptIdleTimeout.vbs <timeout>"
wscript.echo
wscript.echo "Set async accept timeout to <timeout> value (in sec)"
wscript.echo "To disable async accept timeout set it to 0"
wscript.Quit 2
end if
set objArray = CreateObject("FPC.Root").GetContainingArray()
Set objVPSet = OpenVPSet(objArray, strVpsGUID)
objVPSet.Value(strVpsPropertyName) = uAcceptIdleTimeout
objArray.Save()
objArray.RestartServices(1)
function OpenVPSet(objParent, strVpsGUID)
Set objVPSets = objParent.VendorParametersSets
On Error Resume Next
Set OpenVPSet = objVPSets.Item(strVpsGUID)
' Save the Err properties in case it needs to be re-raised
errNumber = Err.Number
errSource = Err.Source
errDescription = Err.Description
errHelpFile = Err.HelpFile
errHelpContext = Err.HelpContext
On Error GoTo 0
if errNumber = Error_FileNotFound Then
Set OpenVPSet = objVPSets.Add(strVpsGUID)
Elseif errNumber < 0 Then
' An error other than "file not found" occurred -- re-raise the error,
' this time not under "On Error Resume Next"
Err.Raise errNumber, errSource, errDescription, errHelpFile, errHelpContext
End If
end function