openvpn.config/CLIENT_DATA/reg_ndiwswan_bind.vbs
2012-04-05 14:33:15 +02:00

38 lines
920 B
Plaintext

Main()
Sub Main()
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Linkage"
strValueName = "Bind"
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, arrValues
Dim colNewVals
Set colNewVals = CreateObject("Scripting.Dictionary")
flag = false
For Each strValue In arrValues
If strValue = "\Device\NdisWanIp" Then
colNewVals.Add 0, strValue
flag = true
Exit For
End If
Next
If flag = false Then
Exit Sub
End If
i = 1
For Each strValue In arrValues
If strValue <> "\Device\NdisWanIp" Then
colNewVals.Add i, strValue
i = i + 1
End If
Next
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,colNewVals.Items
End Sub