Script to enable SmartScreen in Windows 8 (VBScript)

Introduction

This VBScript shows how to enable SmartScreen in Windows 8.

Scenarios

Some of users want to use script to enable SmartScreen in Windows 8 due to some automation tasks. This script can help user to enable SmartScreen via script.

Script

Step 1: On the Start page, type cmd. Press and hold or right-click Command Prompt, and then tap or click Run as administrator.

Step 2: Run this VBScript with cscript in the Windows Command Console (type the path of the script at the command prompt)

When script finishes running, you will see something as shown in the following figure.

Note

The default setting option of SmartScreen is 2.

Their functions respective are described as follows, and you can directly replace the value of script.

0 – Don’t do anything (turn off Windows SmartScreen)

1 – Warn before running an unrecognized app, but don’t require administrator approval

2 – Get administrator approval before running an unrecognized app from the Internet (recommended)

Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page. 

VB Script
Edit|Remove
'determine if a registry key exists  
If IsNull(dwValue) Then 
    'if the registry key does not exist, create a new registry key 
    objShell.RegWrite regKeyPath,2,"REG_DWORD" 
    WScript.Echo "Turn on SmartScreen successfully." 
Else 
    If dwValue = 2 Then 
        WScript.Echo "You have already turn on SmartScreen successfully." 
    Else 
        objShell.RegWrite regKeyPath,2,"REG_DWORD" 
        WScript.Echo "Turn on SmartScreen successfully." 
    End If 
End If

Prerequisite

Windows 8