Bart's Weblog

Just a blog…

Archive for the ‘VBScript’ Category

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

Posted in Scripting, VBScript | 8 Comments »