8

I want to update Windows Defender's definitions every hour and came up with the idea of using the Task Scheduler to execute the Defender update service with the signature update argument.

~/Windows Defender/MpCmdRun -SignatureUpdate

This works pretty well but opens up a cmd window every hour and I want to run it silently in the background.

I am aware of the registry mod that can be done to increase the update frequency but do not want to do that hack over and over again after critical Defender updates after which the registry goes back to the original settings.

I am not very familiar with cmd arguments. I know that some executables work with the /silent argument for background launching, but it doesn't help. What else can I try or use?

Karan
  • 57,289
Afzal
  • 1,395

5 Answers5

4

Use a VBS file instead of a CMD file and schedule it as usual with your Task Scheduler.

VBScript's run method can open other programs in a hidden window via its second argument (, 0). The tricky part was the escaping together with the argument -SignatureUpdate

set objShell = createobject("wscript.shell")  
objShell.Run("""C:\Program Files\Windows Defender\MpCmdRun.exe"" ""-SignatureUpdate""") , 0

Now you won't see any window during Windows Defender update. Only a task manager process is visible:

enter image description here


Other possible settings for intWindowStyle:

0 = Hide the window and activate another window.
1 = Activate and display the window. (restore size and position).
2 = Activate & minimize.
3 = Activate & maximize.
4 = Restore. The active window remains active.
5 = Activate & Restore.
6 = Minimize & activate the next top-level window in the Z order.
7 = Minimize. The active window remains active.
8 = Display the window in its current state. The active window remains active.
9 = Restore & Activate. Specify this flag when restoring a minimized window.
10 = Sets the show-state based on the state of the program that started the application.

Indrek
  • 24,874
nixda
  • 27,634
3

This works pretty well but opens up a cmd window every hour and I want to run it silently in the background.

I always use task scheduler on MSE and in W8 on Defender, with the parameters you also state. To prevent the cmd window to open you have to change the user account, on the general tab in the task scheduler, to SYSTEM and check the box high priority.

Now it should work smoothly!

Jawa
  • 3,679
IJpie
  • 31
2
  1. Instead of using %ProgramFiles%\Windows Defender\MpCmdRun.exe -SignatureUpdate, try
    %ProgramFiles%\Windows Defender\MSASCui.exe -Update instead.

  2. If option 1 does not work, you can use Hidden Start to hide the cmd window:

Console applications and batch files are regularly run at Windows startup or in a schedule. The main inconvenience of this is that each application opens a console window that flickers on the screen. Hidden Start (or Hstart) is a lightweight command line utility that allows you to run console applications and batch files without any window in the background, handle UAC privilege elevation under Windows 7 and Vista, start multiple commands in parallel or synchronously, and much more.

1

Karan
  • 57,289
1

Hourly scheduled update

schtasks /create /tn "Defender Definition Update" /sc HOURLY /ru SYSTEM /rl HIGHEST /tr "'C:\Program Files\Windows Defender\MpCmdRun.exe' -SignatureUpdate -MMPC"

Remove scheduled task

schtasks /delete /tn "Defender Definition Update"
zamiere
  • 11
  • 1
0

Here's a free app that will hide the command window:

enter image description here

Schedule it as such:

cmdNoWnd "C:\Program Files\Windows Defender\MpCmdRun.exe" -SignatureUpdate

I set it up to run every hour in Windows Task Scheduler.

c00000fd
  • 567