Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing IE-settings

0 views
Skip to first unread message

Ingo Streek

unread,
Nov 30, 2003, 11:10:12 AM11/30/03
to
Hi,

is it possible to change the security options of Internet Explorer by a
VBScript?

I usually run the IE with security level set to high in the Internet Zone
but some sites require medium level. My preferred solution would be to make
the change via a button within the IE itself.

Any ideas?

Ingo


Michael Harris (MVP)

unread,
Nov 30, 2003, 2:58:06 PM11/30/03
to


Not possible. If client side script could change client side security, what
would be the point of client side security?


--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

Tom Brown

unread,
Nov 30, 2003, 4:34:38 PM11/30/03
to

"Ingo Streek" <In...@Streek.de> wrote in message news:bqd4q3$n2l$1...@online.de...

Hi,

"If client side script could change client side security, what
would be the point of client side security"

- Michael Harris (MVP), 2003

Priceless!

IE "security settings" are stored in the registry under this key:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\
and under the appropriate \zones\ subkey in HLKM and HKCU

This code was designed for something similar. It should show you the path.
you could add a shortcut in IE's right-click menu, or bookmark it
Let me know if you want to alter Office security settings as well ;-)


'VB Script to change IE security settings
Option Explicit

Const MY_COMPUTER_ZONE = 0
Const LOCAL_INTRANET_ZONE = 1
Const TRUSTED_ZONE = 2
Const INTERNET_ZONE = 3
Const RESTRICTED_ZONE = 4

Dim WSHShell
Dim a,b,c,i,z
Dim reg(1)


' These key names contain the permissions to want to set
' Look in the registry to get the right key names

reg(0) = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "SO\COOKIE\CookiePersistent\Query\"

reg(1) = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "SO\COOKIE\CookieSession\Allow\"


Set WSHShell = WScript.CreateObject("WScript.Shell")

' looping through the array of keys:
For i = LBound(reg) To UBound(reg)

' these tell you what to write:
a = WSHShell.RegRead(reg(i) & "RegPath")
b = WSHShell.RegRead(reg(i) & "ValueName")
c = WSHShell.RegRead(reg(i) & "CheckedValue")

' For z = 0 To 4 ' use a loop here to write to each zone
z = INTERNET_ZONE

' write the key
WSHShell.RegWrite "HKCU\" & Replace(a, "%s", z) & "\" & b, _
c, "REG_DWORD"

' Next

Next


Bob Barrows

unread,
Nov 30, 2003, 6:10:11 PM11/30/03
to
Tom Brown wrote:
> "Ingo Streek" <In...@Streek.de> wrote in message
> news:bqd4q3$n2l$1...@online.de...
>> Hi,
>>
>> is it possible to change the security options of Internet Explorer
>> by a VBScript?
>>
>> I usually run the IE with security level set to high in the Internet
>> Zone but some sites require medium level. My preferred solution
>> would be to make the change via a button within the IE itself.
>>
>> Any ideas?
>>
>> Ingo
>>
>>
>
>
>
> Hi,
>
> "If client side script could change client side security, what
> would be the point of client side security"
> - Michael Harris (MVP), 2003
>
> Priceless!
<snip>
And try running this code in a non-hta web-page ...

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Tom Brown

unread,
Nov 30, 2003, 7:35:05 PM11/30/03
to

"Bob Barrows" <reb0...@NOyahoo.SPAMcom> wrote in message
news:ufdYjd5t...@TK2MSFTNGP09.phx.gbl...

> <snip>
> And try running this code in a non-hta web-page ...
>

Who said anything about a web page?


Bob Barrows

unread,
Nov 30, 2003, 7:39:52 PM11/30/03
to

Ummm - Michael Harris did?

I focussed on client-side code since you seemed so intent on denigrating
Michael's completely factual statement. Ok, so his reply did not really
address the question asked by the original poster, but... haven't you ever
misread a question on these newsgroups?

Tom Brown

unread,
Nov 30, 2003, 8:40:46 PM11/30/03
to

"Bob Barrows" <reb0...@NOyahoo.SPAMcom> wrote in message
news:ufdYjd5t...@TK2MSFTNGP09.phx.gbl...
> Tom Brown wrote:
> > "Ingo Streek" <In...@Streek.de> wrote in message
> > news:bqd4q3$n2l$1...@online.de...
> >> Hi,
> >>
> >> is it possible to change the security options of Internet Explorer
> >> by a VBScript?
> >>
> >> I usually run the IE with security level set to high in the Internet
> >> Zone but some sites require medium level. My preferred solution
> >> would be to make the change via a button within the IE itself.
> >>
> >> Any ideas?
> >>
> >> Ingo
> >>
> >>
> >
> >
> >
> > Hi,
> >
> > "If client side script could change client side security, what
> > would be the point of client side security"
> > - Michael Harris (MVP), 2003
> >
> > Priceless!
> <snip>
> And try running this code in a non-hta web-page ...
>


It will work if it is run in the context of "My Computer" with the right
permission
i.e. any page on the local filesystem.
A bookmarked page called "c:\Adjust Security.htm" perhaps?

You would need to remove the wscript. from this line:
WScript.CreateObject("WScript.Shell")
and put html and script tags around the code

Tom Brown

unread,
Nov 30, 2003, 9:37:05 PM11/30/03
to

"Bob Barrows" <reb0...@NOyahoo.SPAMcom> wrote in message
news:et2fqP6...@TK2MSFTNGP09.phx.gbl...

> Tom Brown wrote:
> > "Bob Barrows" <reb0...@NOyahoo.SPAMcom> wrote in message
> > news:ufdYjd5t...@TK2MSFTNGP09.phx.gbl...
> >
> >> <snip>
> >> And try running this code in a non-hta web-page ...
> >>
> >
> > Who said anything about a web page?
>
> Ummm - Michael Harris did?


No he didn't!

>
> I focussed on client-side code since you seemed so intent on denigrating
> Michael's completely factual statement. Ok, so his reply did not really
> address the question asked by the original poster, but... haven't you ever
> misread a question on these newsgroups?
>
> Bob Barrows
>


OK, a bit harsh since I think I know exactly what he thinks he read and what he
thinks he means, and for sure what you mean, but it was such a peach of a reply,
in totally the wrong context, and said with such definitive authority. It was
asking for it!

Michael Harris (MVP)

unread,
Nov 30, 2003, 10:39:28 PM11/30/03
to
> Who said anything about a web page?


To quote the OP...

"...My preferred solution would be to make
the change via a button within the IE itself...."

Bob Barrows

unread,
Dec 1, 2003, 6:10:10 AM12/1/03
to
Tom Brown wrote:
> "Bob Barrows" <reb0...@NOyahoo.SPAMcom> wrote in message
> news:et2fqP6...@TK2MSFTNGP09.phx.gbl...
>> Tom Brown wrote:
>>> "Bob Barrows" <reb0...@NOyahoo.SPAMcom> wrote in message
>>> news:ufdYjd5t...@TK2MSFTNGP09.phx.gbl...
>>>
>>>> <snip>
>>>> And try running this code in a non-hta web-page ...
>>>>
>>>
>>> Who said anything about a web page?
>>
>> Ummm - Michael Harris did?
>
>
> No he didn't!
>
Not really wanting to prolong this any further but, "client-side" commonly
refers to code running in a web page.

My apologies for overreacting last night.

mayayana

unread,
Dec 1, 2003, 9:32:24 AM12/1/03
to
You'd want to change the settings in
HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3

When you change security level it copies the relevant settings
from HKLM\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\TemplatePolicies
into the key above.

You can also customize what medium and high settings actually
are by modifying the relevant TemplatePolicies settings. The setting
values are just numbers, like "1201", but Microsoft has online docs
that detail what the various settings connect to. (For instance,
if you're going to use IE and go to the trouble to change security
settings back and forth, then you may as well actually make high
security high by disabling things like Java and ActiveX in the
TemplatePolicies\High key.)

The only problem with changing levels via script is
that it won't take until you close and re-open IE. So it's
really no easier than going through the IE menu.

--
--


Ingo Streek <In...@Streek.de> wrote in message news:bqd4q3$n2l$1...@online.de...

Ingo Streek

unread,
Dec 2, 2003, 8:19:16 AM12/2/03
to
Hi Tom,

thanks a lot, this will help a great deal. If any further problems arise, I
will contact you.

Ingo

"Tom Brown" <no.e...@no.email> schrieb im Newsbeitrag
news:bqdnpd$pe2$1...@sparta.btinternet.com...

0 new messages