Bart's Weblog

Just a blog…

VBScript: Bypass the "Open File – Security Warning" dialog from VbScript

Posted by bartvdw on 3030/0303/2008

You have had it before: the “Open File – Security Warning”. Nice feature, but not very interesting during execution of scripts. However you may not want to turn it off.

The simple solution in VBScript has been offered by MS themselve: the SEE_MASK_NOZONECHECKS environment variable. Change it at the start of your script and restore it at the end. Plain & simple!

Sample code (same as the KB article):
set oShell= CreateObject(“Wscript.Shell”)
set oEnv = oShell.Environment(“PROCESS”)
oEnv(“SEE_MASK_NOZONECHECKS”) = 1
oShell.Run “c:\ms04-038\WindowsXP-KB834707-x86-enu /quiet /passive /norestart”,0,True
oEnv.Remove(“SEE_MASK_NOZONECHECKS”)

The Open File – Security Warning dialog box is displayed when you try to silently install a hotfix or an update by using a Visual Basic script in Windows XP Service Pack 2
http://support.microsoft.com/kb/889815

Advertisements

8 Responses to “VBScript: Bypass the "Open File – Security Warning" dialog from VbScript”

  1. Jay said

    That’s awesome.
    Thank you!!

  2. […] hotfix or an update by using a Visual Basic script in Windows XP Service Pack 2 From this website: vbscript: Bypass the "Open File – Security Warning" dialog from VbScript Bart’… __________________ Expert Database Programming MSAccess since 1.0, SQL Server since 6.5, Visual […]

  3. Alex said

    Thank you!
    good solution!

  4. Chad said

    Jawesome! Thanks!

  5. […] https://bartvdw.wordpress.com/2008/03/30/bypass-the-open-file-security-warning-dialog-from-vbscript/ […]

  6. Will this work if i have .exe file and i disable the warning feature then send it to another computer accross the internet, will the settings stay the same ?

  7. Elegant solution! Just what I was looking for, thanks a bunch!

  8. Steve said

    Very useful. Thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: