IThastobecool.com Geeks have opinions too!

23Dec/090

How to suppress the Open File Dialog (zone checking)

If you use scripts for all kind of automation purposes, you definately have stumbled upon the issue that when you run the script, which in turn calls an executable file from somewhere on a network share, you get prompted with a Open File Dialog. Very annoying when you just want your script to run silently.

Fortunately there’s a workaround for this:

Change the SEE_MASK_NOZONECHECKS environment variable

Within your script, temporarily change the SEE_MASK_NOZONECHECKS environment variable to 1.
Note Do not use this as a permanent system environment variable because it will disable all Zone Checking.

VBScript example:


set oShell= CreateObject('Wscript.Shell')
set oEnv = oShell.Environment('PROCESS')

oEnv('SEE_MASK_NOZONECHECKS') = 1

oShell.Run 'somecommand',0,True

oEnv.Remove('SEE_MASK_NOZONECHECKS')

Note: I replaced all double quotes with single quotes in this example because of the syntax highlighting, if you want to use this example, find and replace all single quotes ( ' ) with double quotes ( " )


Powershell example:

$env:SEE_MASK_NOZONECHECKS = 1

somecommand.exe

Remove-Item env:\SEE_MASK_NOZONECHECKS