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