1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
'Da wir den Stringbuilder verwenden
Imports System.Text
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
'Wenn lokales System
If strSystem = System.Environment.MachineName Then
strComputer = "."
Else
strComputer = strSystem
End If
wmiNS = "\root\securityCenter"
wmiQuery = "Select * from AntiVirusProduct"
objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
colItems = objWMIService.ExecQuery(wmiQuery)
For Each objItem In colItems
Try
strSB.AppendLine("Antivirus Company: " & vbTab & vbTab & objItem.companyName.ToString)
Catch ex As Exception
strSB.AppendLine("Antivirus Company: " & vbTab & vbTab & "Nicht ermittelbar")
End Try
Try
strSB.AppendLine("Displayname:" & vbTab & vbTab & vbTab & objItem.displayName.ToString)
Catch ex As Exception
strSB.AppendLine("Displayname:" & vbTab & vbTab & vbTab & "Nicht ermittelbar")
End Try
Try
strSB.AppendLine("On AccessScanning:" & vbTab & vbTab & objItem.onAccessScanningEnabled.ToString)
Catch ex As Exception
strSB.AppendLine("On AccessScanning:" & vbTab & vbTab & "Status nicht ermittelbar")
End Try
Try
strSB.AppendLine("Path To Enable On Access UI:" & vbTab & objItem.pathToEnableOnAccessUI.ToString)
Catch ex As Exception
strSB.AppendLine("Path To Enable On Access UI:" & "Pfad nicht auslesbar")
End Try
Try
strSB.AppendLine("Path To Update UI:" & vbTab & objItem.pathToUpdateUI.ToString)
Catch ex As Exception
strSB.AppendLine("Path To Update UI:" & vbTab & "Nicht ermittelbar")
End Try
Try
If objItem.productUptoDate.ToString.ToLower = "true" Then
strSB.AppendLine("AV Definitions Up To Date:" & vbTab & vbTab & "Pattern sind aktuell")
Else
strSB.AppendLine("AV Definitions Up To Date:" & vbTab & vbTab & "Pattern sind veraltet")
End If
Catch ex As Exception
strSB.AppendLine("AV Definitions Up To Date:" & vbTab & vbTab & "Status nicht ermittelbar")
End Try
Try
strSB.AppendLine("AV Version:" & vbTab & vbTab & vbTab & objItem.versionNumber.ToString)
Catch ex As Exception
strSB.AppendLine("AV Version:" & vbTab & vbTab & vbTab & "Version nicht feststellbar")
End Try
Next
Catch ex As Exception
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
Return strSB.ToString
End Function
|