Script to configure IE setting for auto detect LAN

Posted on Updated on

As I was recently doing some cleanup of old files and or scripts that I’ve written years ago, I came across the below script to change a users IE auto detect LAN.


' This script launches IE (hidden) then changes the auto detect LAN settings
' Written by Nick Moseley on 1/10/11

Const HKCU = &H80000001

Dim oReg, oShell
Set oReg= GetObject("Winmgmts:root\default:StdRegProv")
Set oShell = CreateObject ("WScript.Shell")

' Launch IE
Dim sIeExe
sIeExe = """C:\Program Files\Internet Explorer\iexplore.exe"""
oShell.Run sIeExe, 0, False
WScript.Sleep 30000

' Get the binary regkey
Dim sKeyPath, sValueName, sKeyValue, iRetVal1, iRetVal2
sKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
sValueName = "DefaultConnectionSettings"
iRetVal1 = oReg.GetBinaryValue (HKCU,sKeyPath,sValueName,sKeyValue)

' Set array position 9 to value 9
sKeyValue(8)=1

'write new value to registry
iRetVal2 = oReg.SetBinaryValue(HKCU,sKeyPath,sValueName,sKeyValue)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s