Reputation: 33
I want to add trusted web sites to the windows registry for all users using a VBScript. I currently have a script with me and its given below. I'm neither a Windows guy nor a Visual Basic guy, so I have absolutely no idea whether the script would run or not and would it meet my needs or not. Could someone please explain the script and check whether would it run as expected.
On Error Resume Next
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}\\" & strComputer & _
"\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\EscDomains\google.com"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\EscDomains\google.com\www"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "https"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\google.com"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\google.com\www"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "https"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\EscDomains\hotmail.com"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "https"
dwValue = 1
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\hotmail.com"
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "https"
dwValue = 1
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
If you feel this is an inappropiate script, please share the VBScript which you feel that would work.
Upvotes: 0
Views: 7990
Reputation: 958
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Your script is adding to current user, not all users as you said you need. Will multiple real users be logging into that machine?
The keys you need are:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\<website>.com]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\<website>.com\www]
"http"=dword:00000002
You could create a .reg file with above information for the websites and run it (put "Windows Registry Editor Version 5.00
" at the top of that .reg file)
As has already been indicated, some quality time on Google will definitely enhance your knowledge of what the script you posted is trying to do and how to modify it. Don't hesitate to ask any specific (as opposed very general) questions.
Upvotes: 0