Wednesday, October 23, 2013

PowerShell Script : Find the name of Installed Antivirus on local or remote laptop.

 

Do you ever want to know what antivirus installed on remote laptop, or does remote system has a antivirus or not, knowing this is  always a pain, normally you have to call user and ask them,.

Today i have found a cool namespace named “"root\SecurityCenter2" ”  and this name space has a class “AntiVirusProduct ”, you just need to query that class and it will show you the name { and few more info}  of the antivirus installed.

Download Link : http://gallery.technet.microsoft.com/Get-The-Name-of-Installed-b10fd073 

You can download a little script { if you like } from the above link and when i run it, you can see that it is showing me the name of antivirus installed on my laptop.

23-10-2013 18-14-35

You can run the above script on remote laptop too.

function Get-AntivirusName {

 

[cmdletBinding()]   

param (

[string]$ComputerName = "$env:computername" ,

$Credential

)

 

 

       BEGIN

              {

                     # Setting WMI query in a variable

              $wmiQuery = "SELECT * FROM AntiVirusProduct"

 

              }

 

 

       PROCESS

              {

                     # doing getting wmi

               

                     $AntivirusProduct = Get-WmiObject -Namespace "root\SecurityCenter2" -Query $wmiQuery  @psboundparameters # -ErrorVariable myError -ErrorAction 'SilentlyContinue'         

            Write-host $AntivirusProduct.displayName -ForegroundColor Cyan

 

              }

 

       END {

 

              }

} #end  of the function

 

Thanks for reading.

Aman Dhally

Tested on : Windows7 [64 bit]

 
clip_image001 clip_image002 clip_image003 clip_image005  clip_image007

8 comments:

  1. please if you can do a tutorial to explain more, I nedd this solution

    ReplyDelete
  2. A very nice piece of scripting indeed. Can this be done from a list of computers?

    ReplyDelete
  3. A very nice piece of scripting indeed. Can this be done from a list of computers?

    ReplyDelete
  4. Please help me in getting the similar results for 2003 and 2008 servers

    ReplyDelete
  5. Please help me in getting the similar results for 2003 and 2008 servers

    ReplyDelete
  6. foreach ($item in $computerlist)
    {
    Get-AntivirusName -computername $item.name
    }

    ReplyDelete
  7. But there is a problem: Get-WmiObject : Invalid namespace "root\SecurityCenter2"

    ReplyDelete
  8. Not available on server products as Security Center isn't there to support it.

    ReplyDelete