[Last Call] Learn how to a build a cloud-first strategyRegister Now


vbs script not working with Group Policy

Posted on 2009-02-19
Medium Priority
Last Modified: 2012-05-06
Within our environment all of our EIs use a Proxy server to access the internet. We also have a few users that have laptops and when they take them home they can not browse the internet since EI is looking for the proxy server. We have created a container within active directory and put all laptops within. We also created a group policy that will execute a logon and logoff vbs script that should set the proxy and then unset it. When we manually run the scripts all works fine. When running from the gp not all variables are set. The address and port are not populated. I was hopping someone could shed some light or adjust the script for it to work properly.

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"

strValueName = "ProxyEnable"
dwValue = 1
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue

strValueName = "ProxyServer"
strValue = "cssapps1:8080"
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

strValueName = "ProxyOverride"
strValue = "<local>"
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue


ProxyEnable and ProxyOverride are set in the registry but ProxyServer does not.

Thanks for your time,
Question by:BartowIT
LVL 33

Expert Comment

by:Todd Gerbert
ID: 23684738
It shouldn't matter, but maybe using the WScript.Shell object might work better...could be a permissions issue with WMI...?

Also, I'm thinking as long as ProxyEnable is set appropriately, you can leave the others set all the time.

And, of course, there's always auto-configure for the proxy settings, though I've never set it up myself.
Set WshShell = CreateObject("WScript.Shell")
strKeyPath = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\"
WshShell.RegWrite strKeyPath & "ProxyEnable", 1, "REG_DWORD"
WshShell.RegWrite strKeyPath & "ProxyServer", "cssapps1:8080", "REG_SZ"
WshShell.RegWrite strKeyPath & "ProxyOverride", "<local>", "REG_SZ"

Open in new window


Accepted Solution

BartowIT earned 0 total points
ID: 23693544
Ok After more testing and googling I found out what was happening. I had to update the group policy its self. I had to Navigate to Computer Configuration > Administrative Templates > System > Group Policy and Enable User Group Policy loopback processing mode. I also Enable "Run startup scripts visible"

All works fine.

Thanks for your help,

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question