How to enable/disable the windows defender in C++

shines7 41 Reputation points
2022-01-18T07:07:24.567+00:00

I have turned off real-time protection of windows defender and turned it on.
And I checked the status value with "Get-MpPreference -verbose" with powershell.
It was confirmed that the value of "DisableRealtimeMoniotring" was changed to True/False.
I tried "Set-MpPreference -DisableRealtimeMoniotring $false/$true"
In this case, the state value has not changed.

I want to know the activation status value of windows defender.
I want to enable/disable windows defender.
How to do it in c++/powershell or etc?
The best is C++.

Windows for business Windows Client for IT Pros User experience Other
Developer technologies C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. YujianYao-MSFT 4,296 Reputation points Microsoft External Staff
    2022-01-19T02:09:42.623+00:00

    Hi @shines7 ,

    I suggest you to read the document of WDEnable and WDStatus which are able to enable/disable Windows Defender and view the status of Windows Defender.

    Note:

    WDEnable is no longer available for use as of Windows 10, version 1607.

    Beginning in Windows 10, version 1607 and Windows Server 2016, the WDEnable function always returns E_NOTIMPL.

    Best regards,

    Elya


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. S.Sengupta 24,476 Reputation points MVP
    2022-01-27T12:37:49.187+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.