Check if antivirus software is running with an acceptable status or not?

Herry Markowitz

Well-known member
Joined
Oct 22, 2015
Messages
46
Programming Experience
1-3
Hi beautiful people,
I need a vb.net code which checks if antivirus software is running with an acceptable status or not?
Thanks in advance.
 
I have just found a youtube video here: https://www.youtube.com/watch?v=-4xUuCbgwwY
This is the vb.net code;
VB.NET:
Imports System.TextPublic Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Label1.Text = (GetAVInformation(System.Environment.MachineName))
    End Sub
    Private Function GetAVInformation(ByVal strSystem As String) As String
        Dim strComputer As String = String.Empty
        Dim wmiNS As String = String.Empty
        Dim wmiQuery As String = String.Empty
        Dim objWMIService As Object
        Dim ColItems As Object
        Dim objItem As Object
        Dim strSB As New StringBuilder
        Try
            If strSystem = System.Environment.MachineName Then
                strComputer = "."
            Else
                strComputer = strSystem
            End If
            wmiNS = "\root\securityCenter2"  ' In Windows 7 & Vista is SecurityCenter2 in XP it is only SecurityCenter '
            wmiNS = "Select * from AntiVirusProduct"
            objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
            ColItems = objWMIService.ExecQuary(wmiQuery)
            For Each objItem In ColItems
                Try
                    strSB.AppendLine(objItem.displayname.ToString)
                Catch ex As Exception
                    strSB.AppendLine("??" & vbTab & vbTab & vbTab & "??")
                End Try
            Next
        Catch ex As Exception
            MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
        Return strSB.ToString
    End Function
End Class

This is the error I have;
http://prntscr.com/8zx739

Any support regarding this error?
 
Last edited:
Last edited:
Back
Top