Hackoo
asked on
How to get the name of the installed antivirus ?
I want to display only the installed antivirus (in my case is the last item) and not all items of the collection, for example, it shows me:
Windows Defender
Malwarebytes
ESET Endpoint Security
So I added an ArrayList whose purpose is to display only the last Item which is: ESET Endpoint Security
If you have any advice to go, I am at your disposal, to improve it!
Windows Defender
Malwarebytes
ESET Endpoint Security
So I added an ArrayList whose purpose is to display only the last Item which is: ESET Endpoint Security
wscript.echo GetAntiVirusName
Function GetAntiVirusName()
Set objWMIService = GetObject("winmgmts:\\.\root\SecurityCenter2")
Set colItems = objWMIService.ExecQuery("Select * From AntiVirusProduct")
On Error Resume Next
If Err <> 0 Then
GetAntiVirusName = "No AntiVirus "
Else
Set ArrayList = CreateObject("System.Collections.ArrayList")
For Each objItem In colItems
ArrayList.add objItem.displayName
Next
End If
GetAntiVirusName = ArrayList(ArrayList.count-1)
End Function
How to know if there is no antivirus installed by this function?If you have any advice to go, I am at your disposal, to improve it!
On what version of Windows, and on what *range* of versions of Windows? The farther back one goes, the harder it becomes to determine this information.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.