Run .vbs file without Security warning

When you try to run/execute a .vbs file, you will be prompted with Security Warning. The security warning is good and it saves your PC from some malicious programs. But its an annoyance when you try to execute your own code.

As VBScript developer you will face this issue a lot when try to Schedule your task. To overcome this Microsoft suggest to set the Environment variable called  SEE_MASK_NOZONECHECKS to 1.

set oShell= CreateObject("Wscript.Shell")
set oEnv = oShell.Environment("PROCESS")
oEnv("SEE_MASK_NOZONECHECKS") = 1
oShell.Run "c:\projects\sample.vbs   /norestart",0,True
oEnv.Remove("SEE_MASK_NOZONECHECKS")

 

Recently tested this code on  Windows 7 64 bit and it worked fine.

Source: 

http://support.microsoft.com/kb/889815

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: