Const SE_VPS_GUID = "{143F5698-103B-12D4-FF34-1F34767DEabc}"
Const SE_VPS_NAME = "AdditionalVIPsAndMask"
Const SE_VPS_VALUE = "<additionVIP1>/<subnetMask1>; <additionVIP2>/<subnetMask2>;"
' To run: cscript confignlbAdditionalVips.vbs /Network:External
' use the network name as appropriate.
' You must remove comment marks on the correct line to add or remove the VPS.
Sub NLBConfiguration()
' Create the root obect.
Dim root ' The FPCLib.FPC root object
Set root = CreateObject("FPC.Root")
'Declare the other objects needed.
Dim array ' An FPCArray object
Dim NetworkConfig ' An FPCNetworkConfiguration object
' Get references to the array object
' and the protocols collection.
Set array = root.GetContainingArray
On Error Resume Next
Set NetworkConfig = array.NetworkConfiguration
CheckError
Dim Networks ' FPCNetworks
Set Networks = NetworkConfig.Networks
Dim Network ' FPCNetwork
Set Network = Networks(WScript.Arguments.Named("Network"))
If Err.Number <> 0 Then
Wscript.Echo "Cannot find network, error- " & Hex(Err.Number) & " " & Err.Description
Err.Clear
WScript.Quit(1)
End If
Dim VendorSets ' An FPCVendorParametersSets collection
Dim VendorSet ' An FPCVendorParametersSet object
Set VendorSets = Network.VendorParametersSets
CheckError
On Error Resume Next
Set VendorSet = VendorSets.Item( SE_VPS_GUID )
If Err.Number <> 0 Then
Err.Clear
' Add the item
Set VendorSet = VendorSets.Add( SE_VPS_GUID )
CheckError
WScript.Echo "New VendorSet added... " & VendorSet.Name
Else
WScript.Echo "Existing VendorSet found... value- " & VendorSet.Value(SE_VPS_NAME)
End If
Err.Clear
' Remove the comment mark from the following line to set VIPs. Make sure that there are no additional
' VIPs defined in the UI.
'
' VendorSet.Value(SE_VPS_NAME) = SE_VPS_VALUE
' Remove the comment mark from the following line to delete the VPS.
'
' VendorSet.RemoveValue(SE_VPS_NAME)
If Err.Number <> 0 Then
CheckError
End If
Networks.Save false, true
WScript.Echo "Done saving..."
End Sub
Sub CheckError()
If Err.Number <> 0 Then
WScript.Echo "An error occurred: 0x" & Hex(Err.Number) & " " & Err.Description
Err.Clear
End If
End Sub
If Not WScript.Arguments.Named.Exists("Network") Then
WScript.Echo "Network not defined"
WScript.Quit(1)
End If
NLBConfiguration