i help with a login script to set proxy settings for users. i don't want to use group policy for this if i don't have to. can anyone please help with this. here is what i have so far.
'Script Start
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Proxy")
Const HKEY_CURRENT_USER = &H80000001
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
strProxyOveride ="192.168.1.0"
dim dWord
objRegistry.GetDWORDValue HKEY_CURRENT_USER , strKeyPath , strValueName ,dWord
if dWord = 1 then
dwValue = 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
else
For Each objItem in colItems
dwValue = 1
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
objItem.SetProxySetting "192.168.1.1","8080" 'Change parameters here
Next
end if
'Script Start
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Proxy")
Const HKEY_CURRENT_USER = &H80000001
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
strProxyOveride ="192.168.1.0"
dim dWord
objRegistry.GetDWORDValue HKEY_CURRENT_USER , strKeyPath , strValueName ,dWord
if dWord = 1 then
dwValue = 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
else
For Each objItem in colItems
dwValue = 1
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
objItem.SetProxySetting "192.168.1.1","8080" 'Change parameters here
Next
end if