Share via

Setting Up Microsoft Defender Full Scan in Task Scheduler

Anonymous
2020-10-13T21:46:50+00:00

I have successfully setup a scheduled task to run a full Microsoft Defender scan Monday/Wednesday/Friday mornings.  This points at the following path to run the MpCmdRun.exe program:  C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.2009.7-0.  There are two folders in the Platform directory that were created about a month part due to updates to Microsoft Defender, each has a copy of the MpCmdRun.exe program.  How often will these new folders be created and how can I keep my scheduled scan task pointed at the most current version of MpCmdRun.exe?  Is there an environment variable that is updated when the folder changes (I can't find one) or some other way to determine that an update to Microsoft Defender has changed the folder for MpCmdRun.exe?

Appreciate your help with this.

Windows for home | Windows 10 | Security and privacy

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2020-10-14T12:56:30+00:00

    Alternatively, you can create a script that gets the latest folder in that path and pass it as a variable. For example, using batch (-scan -1 = quick scan, -2 would be full):

    set WinSecDefndrPath="dir "C:\ProgramData\Microsoft\Windows Defender\Platform" /ad /od /b"
    FOR /F "tokens=*" %%i IN (' %WinSecDefndrPath% ') Do Set WinSecDefndrPath=%%i
    "C:\ProgramData\Microsoft\Windows Defender\Platform\%WinSecDefndrPath%\MpCmdRun.exe" -Scan -1
    

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2020-10-14T11:59:32+00:00

    I guess I am just overly cautious, had a bad experience recently where a macro enabled Excel file was opened and not detected and it took a day and about 5 full scans to get all instances of undetected viruses in about 10 emails to get the system clean.  I run the full scan three times a week at 12:01 AM and it takes about 2 hours so it is not interfering with anything.

    My point is if Microsoft is going to create a new folder for each Platform update to MpCmdRun it will cause anything pointing to it to run an older version.  It would be great if they created a environment variable that points to the current path for the current MpCmdRun that could be used to insure your always getting the correct version.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2020-10-14T12:00:56+00:00

    I hope you right, that would be great although I don't hold out much hope :-)

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2020-10-13T22:05:20+00:00

    Hi Golfinfool54,

    Only the latest Platform is in use. The other is only there for fallback if needed.

    Only the latest MpCmdRun is in use.

    I question whether you need to schedule Full scans though. They are quite time consuming,

    and the full scan is only needed if you have discovered malware on your PC already.

    Real-Time and Quick Scan will detect malware if it infects your PC.  Full scan is only used

    to locate all the instances of the malware that has already been detected.

    Glen

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2020-10-13T22:01:41+00:00

    Hi and thanks for reaching out. My name is William. I'm a Microsoft Windows Certified Professional and Systems Administrator. I'll be happy to help you out today.

    I am guessing any scheduled task path is is updated to point to the current platform folder whenever am update is applied. I am basing my assumption on the already existing task under the Task Scheduler > Microsoft > Windows > Windows Defender > Windows Defender Scheduled Scan which points to the current platform. Further, this Microsoft article outlines using the existing scheduled task: https://support.microsoft.com/en-us/windows/sch...

    Was this answer helpful?

    0 comments No comments