Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the installed antivirus software and firewall programmatically?

How can I get information about the antivirus software and firewall software that is installed on a Windows computer?

like image 750
nexno Avatar asked Oct 02 '22 10:10

nexno


1 Answers

You can use ManagementObjectSearcher to obtain this information.

 Public Function GetAntivirus() As String
    Try
        Dim data As String = String.Empty
        For Each firewall As ManagementObject In New ManagementObjectSearcher("root\SecurityCenter" & IIf(My.Computer.Info.OSFullName.Contains("XP"), "", "2").ToString, "SELECT * FROM AntiVirusProduct").Get
            data &= firewall("displayName").ToString
        Next
        If Not data = String.Empty Then
            Return data
        Else
            Return "No Antivirus"
        End If

    Catch
        Return "No Antivirus"
    End Try

End Function

Public Function GetFirewall() As String
    Try

            Dim data As String = String.Empty
            For Each firewall As ManagementObject In New ManagementObjectSearcher("root\SecurityCenter" & IIf(My.Computer.Info.OSFullName.Contains("XP"), "", "2").ToString, "SELECT * FROM FirewallProduct").Get
                Data &= firewall("displayName").ToString
            Next
        If Not data = String.Empty Then
            Return data
        Else
            Return "No Firewall"
        End If
        Catch
            Return "No Firewall"
        End Try

End Function
like image 194
Robert Harvey Avatar answered Oct 10 '22 10:10

Robert Harvey