Update Windows Defender on your own Schedule as a hidden task

In a previous post I explained how we could update Windows Defender automatically if Windows automatic updates are turned off. The problem with the solution I suggested there is that after recent Windows Features Updates the Windows Task Scheduler opens a window upon updating the Defender — updates cannot be hidden anymore!, and this is really annoying, especially if you like to perform update checks several times a day.

It is easy though to solve this new problem and update Windows Defender in the background as a hidden task. You only need two simple text files and a new task in the Windows Task Scheduler. If you have a folder where you put your scripts, batch files and the like, or in any folder you prefer, create two plain text (notepad) files, the first one with a .JS extension and the second with a .PS1 extension. For instance, the first file could be named WinDefender1.js and the second could be named WinDefender2.ps1.

The first file (JS) is the main file that performs the update, using the second file (PS1) as an argument. In the first file (JS) paste this command:

var wshShell = new ActiveXObject("WScript.Shell");
wshShell.Run('%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -File "C:\\WhateverFolder\\WinDefender2.ps1"', 0, false);

replacing C:\\WhateverFolder\\WinDefender2.ps1 with the address and file name you have chosen for your second (PS1) file. Just take care in your address to use double backslashes (\\).

In the second file, WinDefender2.ps1 paste this option: Update-MpSignature. Then create a new task in Windows Task Scheduler to be performed at Logon and perhaps several times a day, defining as action to “Start a program”, defining as program wscript, and adding in the textbox below as argument inside quotes the address of the first (JS) file:


That’s it! Click OK, and enjoy!