The following code in a VB Script file will allow me to get the proxy enabled flag on a machine. For example, I do not have the proxy enabled on my machine, so it returns "0".
However, these are Windows Domain computers and in most cases I am getting back nothing - not 0, but a blank.
I am assuming this is because I have a domain policy that is enforcing the proxy settings (as ON).
SO, the question is how do I read that? Is it a different registry key, or do I have to read something completely different like network settings somehow?
const HKEY_CURRENT_USER = &H80000001
Set oReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
oReg.GetD开发者_JS百科WORDValue _
HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
If registry value ProxySettingsPerUser
in key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
is 1, then the proxy is defined per user (i.e. it can be retrieved from the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
key).
If ProxySettingsPerUser
is 0, then the proxy is defined for the whole computer (i.e. the proxy settings are stored in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings
).
精彩评论