VMware Cloud Community
Dlouw
Enthusiast
Enthusiast

Checking VM Guests for AV

Hi,

Is there a script that I can run that can check all VM guests for Forefront Antivirus. (Want to know if installed or not)

Thanks

Deon

0 Kudos
6 Replies
fabiendibot
Enthusiast
Enthusiast

You should use Invoke-VMScript associated with something like Get-WMIObject Win32-Product | ? { $_.Name -like "Forefront" }

0 Kudos
Dlouw
Enthusiast
Enthusiast

Thanks fabiendibot, could you give me more details as I am new to scripting.

0 Kudos
fabiendibot
Enthusiast
Enthusiast

Hello,

You can try something like this .. At first try Get-WmiObject Win32_Product | ? { $_.Name -like "*Forefront*" } locally, i don't have forefront here so i don't know how it's named in Win32_Product list Smiley Happy

$GuestUser = "Administrator"

$Password = "PutYourPasswordHere"

$Script = '

if (Get-WmiObject Win32_Product | ? { $_.Name -like "*Forefront*" }) {

    Write-Host "Forefront installed"

}

'

Get-VM | % {

     $VM = $_

         Get-View $_  | % {

        if ( $_.Summary.Guest.GuestFullName -contains "Windows" ) {

            Invoke-VMScript -VM $VM -ScriptText $script -ScriptType Powershell -GuestUser $GuestUser -GuestPassword $Password

        }

    }

0 Kudos
Dlouw
Enthusiast
Enthusiast

Hi,

I tried the script and at first it gave me the error, "Missing closing '}' in statement block." I then added "}" at the end.  The script then ran but returned no value?

Not sure what I am doing wrong.

Once again thanks for the help.

Cheers

0 Kudos
fabiendibot
Enthusiast
Enthusiast

You can try something like this .. At first try Get-WmiObject Win32_Product | ? { $_.Name -like "*Forefront*" } locally, i don't have forefront here so i don't know how it's named in Win32_Product list Smiley Happy

You first have to find what is the fore front name in WIN32_Product class...

You will have to laucnh a powershell console and put your hands on it :smileygrin:

0 Kudos
Dlouw
Enthusiast
Enthusiast

IdentifyingNumber : {XXXXXXXXXXXXXX}

Name              : Microsoft Forefront Endpoint Protection 2010 Server Managem

                    ent

Vendor            : Microsoft Corporation

Version           : 2.1.1116.0

Caption           : Microsoft Forefront Endpoint Protection 2010 Server Managem

                    ent

This is what I get when I run the Get-WmiObject Win32_Product | ? { $_.Name -like "*Forefront*" } locally

0 Kudos