Jump to content

sctipt


lingk

Recommended Posts

I have some notebook users that need to be abel to change there proxy settings when they are off site. would it be possible to make a batch file or vbscrip they could click on to switch these settings?

Link to comment
Share on other sites


I have some notebook users that need to be abel to change there proxy settings when they are off site. would it be possible to make a batch file or vbscrip they could click on to switch these settings?

I do not know if this is what you wanted but read this Link

Link to comment
Share on other sites

ok so here is the scrip, it works but i want to build onto it. I want it to check the

strValueName = "ProxyEnable"
dwValue = 1

if the dwValue is 1, then set it to 0 and if it's 0 run the rest of the script to set it to 1 and add the proxy settings. this way the user doesn't have to click differently scrips, just click when they get home and click it again when they are done. when the user logs in back on the domain the GPO policy doesn't seam to be in effect after the script has ran.

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 = "10.193.24.6"
strValue = "svcproxy:800"
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

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

Link to comment
Share on other sites

Here a quick Example of how you could do what you want it to.

const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

'/-> Read The Value
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
objRegistry.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
'/->Check The Value
If dwValue = 0 Then
'/-> If Value Was 0 Then Set It To One
dwValue = 1
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
Else
'/-> If Value Was 1 Then Set It To Zero
dwValue = 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
End If

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...