Run a script as a non-admin

Posted on 2009-04-23
Last Modified: 2012-06-27

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?

Question by:MDWinter
    LVL 19

    Expert Comment

    I assume you are changing registry keys?  If so which keys are you changing?

    Author Comment

    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>;"
    objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

    Open in new window

    LVL 12

    Accepted Solution

    Three points I would ask on this,

    Is the administrator account logging in a local or a domain account?

    Is there a GPO setting proxy settings for these other accounts that does not apply to the administrator account(domain or local)?


    Is there a GPO in place making proxy settings machine specific -vs- user specific?
    \\computer configuration\administrative templates\Internet explorer\make proxy settings per-machine

    might also try a GPO results modeling on the admin account and one of the other user accounts run against the same pc (look at the difference's)
    reaching for straws, hope they help.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
    The viewer will learn how to count occurrences of each item in an array.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now