Link to home
Start Free TrialLog in
Avatar of MDWinter
MDWinter

asked on

Run a script as a non-admin

Hi,

I need to be able to change proxy settings on a Windows 2008 Enterprise x64 server with regularity.

I have written two scripts, and when logged in as Administrator they run fine.

When I try to run the script as a normal user (or another user who has admin privelegaes) the proxy doesn't get changed.

I don't get any error message stating insufficient privelges - it APPEARS that the script executes normally. But when I start IE the proxy settings are unchanged.

I am also unable to get the script to work as a logon script - presumably for same reason.

How can I set it such that this script can be run by any normal user?

Thanks.
Avatar of lamaslany
lamaslany
Flag of United Kingdom of Great Britain and Northern Ireland image

I assume you are changing registry keys?  If so which keys are you changing?
Avatar of MDWinter
MDWinter

ASKER

Yes I am. The script is attached (I stole it from the internet, so I'm not suer EXACTLY what it does...)

The script is attached for reference...
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 = "vw:80"
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
 
strValueName = "ProxyOverride"
strValue = "<local>; www.anglopacific.co.uk"
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of zoofan
zoofan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial