2012年5月31日 星期四

name resolving issue under vpn connection

relate to dns search order.

http://support.microsoft.com/kb/311218

Const HKLM = &H80000002
sComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\default:StdRegProv") 

sKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Linkage"
sValueName = "Bind"

oReg.GetMultiStringValue HKLM, sKeyPath, sValueName, arValues
arValuesNew = Array()

'patch registry
If UCase(arValues(0)) <> UCase("\device\ndiswanip") Then
ReDim Preserve arValuesNew(0)
arValuesNew(0) = "\Device\NdisWanIp"
For Each objarValues in arValues
If UCase(objarValues) <> UCase("\device\ndiswanip") Then
ReDim Preserve arValuesNew(UBound(arValuesNew)+1)
arValuesNew(UBound(arValuesNew)) = objarValues
End If
Next
End If
If UBound(arValuesNew) <> -1 Then
oReg.SetMultiStringValue HKLM, sKeyPath, sValueName, arValuesNew
End If

沒有留言: