Jump to content

Status do Windows Defender


RafaelFranckilin

Recommended Posts

Pessoal, preciso obter o status de windows defender(on/off), mas não sei como fazer isso com o vb.net, Estou usando esse código, mas não é exatamente como eu quero. Vocês podem me ajudar com algo mais simples?

Dim av_searcher As New ManagementObjectSearcher("root\SecurityCenter2", "SELECT * FROM AntivirusProduct")

       For Each info As ManagementObject In av_searcher.Get()
           MsgBox(info.Properties("displayName").Value.ToString())

           Dim AvStatus = Hex(info.Properties("ProductState").Value.ToString())
           If Mid(AvStatus, 2, 2) = "10" Or Mid(AvStatus, 2, 2) = "11" Then
               MsgBox("AntiVirus enabled")
           ElseIf Mid(AvStatus, 2, 2) = "00" Or Mid(AvStatus, 2, 2) = "01" Then
               MsgBox("AntiVirus disabled")
           End If

       Next info
Edited by RafaelFranckilin
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.