Ying Li at myITforum.com

PowerShell & System Center

PoweShell script to check McAfee Virus Definition

Here is a powershell script to check against a list of servers for McAfee version, Scan engine and virus definition version and date. It was translated/upgraded from my previous posted VB script and I added the repository server column here:

$erroractionpreference = "SilentlyContinue"

$a = New-Object -comobject Excel.Application
$a.visible = $True

$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)

$c.Cells.Item(1,1) = "Server Name"
$c.Cells.Item(1,2) = "AV Product"
$c.Cells.Item(1,3) = "Version"
$c.Cells.Item(1,4) = "Scan Engine"
$c.Cells.Item(1,5) = "Virus Definition"
$c.Cells.Item(1,6) = "Virus Definition Date"
$c.Cells.Item(1,7) = "Repository Server"
$c.Cells.Item(1,8) = "Report Time Stamp"

$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True

$intRow = 2

$colComputers = get-content C:\Myworkplace\McAfee\MachineList.txt

foreach ($strComputer in $colComputers)
{
$c.Cells.Item($intRow,1)  = $strComputer

Function GetRegInfo
{
$key="SOFTWARE\Network Associates\TVD\VirusScan Enterprise\CurrentVersion"
$regkey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $strComputer)
$regKey = $regKey.OpenSubKey($key)

$Product = $regKey.GetValue("Product")
$c.Cells.Item($intRow,2)  = $Product

$productver  = $regKey.GetValue("szProductVer")
$c.Cells.Item($intRow,3) = $Productver

$ScanEngine = $regKey.GetValue("szEngineVer")
$c.Cells.Item($intRow,4) = $ScanEngine

$VirDefVer = $regKey.GetValue("szVirDefVer")
$c.Cells.Item($intRow,5) = $VirDefVer

$virDefDate = $regKey.GetValue("szVirDefDate")
$c.Cells.Item($intRow,6) = $virDefDate
}

GetRegInfo

Function GetSiteInfo
{
$x = Test-path "\\$strcomputer\c$\Documents and Settings\All Users\Application Data\McAfee\Common Framework\UpdateHistory.ini"
if($x -eq "True")
{
$y = get-content "\\$strcomputer\c$\Documents and Settings\All Users\Application Data\McAfee\Common Framework\UpdateHistory.ini"
$z = $y[3]
$SiteServer = $z.substring(19,($z.length-19))
}
$c.Cells.Item($intRow,7) = $SiteServer.ToUpper()
}

GetSiteInfo

$c.Cells.Item($intRow,8) = Get-date
 
$intRow = $intRow + 1


}
$d.EntireColumn.AutoFit()
cls

 

 

Posted: Jul 24 2007, 01:56 PM by yli628 | with no comments
Filed under: ,

Comments

No Comments