VBA Script for reporting Mcafee Virus Scan

Hi,

I'd like to write a script which reports the information of the virus scan installed on our network and get it to report back what .dat file is on the machine, now the only virus scan system we use on our network is McAfee!

I'm thinking their could be two ways to write this script the first way is:

put a script on each of the machines and every day at 11am the script runs then put the results on a server location in a text file, i then create another script which takes the information out of X number of .txt files on the server location and converts it into a HTML page or excel page?

second way could be:

create the script and have it run remotely on our server and it reports all the information back to one text file, then exports to HTML or excel?

is this possible or is there a better way of doing this?

LVL 1
xP3000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

merowingerCommented:
in my opiotn a better way is when the script is located on each client, as a script which is executed on the server cannot optain information if the client is offline
0
xP3000Author Commented:
either way i'm happy to do it! but the big question is how would one achieve this?
0
merowingerCommented:
i'm going to write a script but i should know what the script shell do exactly on the client
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

xP3000Author Commented:
the key i need to read from the registry are the following:

\HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\AVEngine\AVDatVersion - I need to read is in decimal not hexadecimal !

\HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\Product Name

and

\HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\Version

I need this to report back to a file file or excel or html for each of the machines I got on our network
0
merowingerCommented:
Allright the following script will create a a textfile with the computername and the captured information of the server. If the file exists it will be removed (user needs permissons on  the share)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set objNet = CreateObject("Wscript.Network")
strFile = "\\server\share\McAfee\" &objNet.ComputerName &".txt"

On Error Resume Next
strAVDatVersion = objShell.RegRead("HKLM\SOFTWARE\McAfee\AVEngine\AVDatVersion")
strProductName = objShell.RegRead("HKLM\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\Product Name")
strVersion = objShell.RegRead("HKLM\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\Version")


If objFSO.FileExists(strFile) Then
	objFSO.DeleteFile(strFile)
End If
Set objFile = objFSO.CreateTextFile(strFile)

objFile.Writeline strAVDatVersion &";" &strProductName &";" &strVersion

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
merowingerCommented:
the next script has to be executed on the server. It will create a output.csv file based on the client created files. If the output.csv exists it will be removed.

.CSV files are easy to open with excel
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("D:\McAfee")
strOutput = "D:\Output.csv"

If objFSO.FileExists(strOutput) Then
	objFSO.DeleteFile(strOutput)
End If
Set objOutput = objFSO.CreateTextFile(strOutput)
objOutput.WriteLine "Computername;AVDatVersion;Product Name;Version"

For Each file In objFolder.Files
	Set objFile = objFSO.OpenTextFile(file)
	Do While Not objFile.AtEndOfStream
		strCurrentLine = objFile.ReadLine
	Loop
	objOutput.WriteLine Replace(objFSO.GetFile(file).Name,".txt","") &";" &strCurrentLine
Next

Open in new window

0
xP3000Author Commented:
Ok,

I have ran the foloowing script:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
Set objNet = CreateObject("Wscript.Network")
strFile = "\\buildserver\PCImages\Support\Structures\McAfee" &objNet.ComputerName &"virus.txt"
 
On Error Resume Next
strAVDatVersion = objShell.RegRead("HKLM\SOFTWARE\McAfee\AVEngine\AVDatVersion")
strProductName = objShell.RegRead("HKLM\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\Product Name")
strVersion = objShell.RegRead("HKLM\SOFTWARE\McAfee\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\Version")
 
 
If objFSO.FileExists(strFile) Then
        objFSO.DeleteFile(strFile)
End If
Set objFile = objFSO.CreateTextFile(strFile)
 
objFile.Writeline strAVDatVersion &";" &strProductName &";" &strVersion

but when i ran this script i'm getting this error: AtlAdvise error 4 ?
0
merowingerCommented:
ok please remote the "on error resume next" line to see all errors.
Is the files created on the server?
0
xP3000Author Commented:
nah the files aren't getting created, I just changed the script to create the file on my c drive still doesnt work
0
merowingerCommented:
have you removed the line?same error?
0
xP3000Author Commented:
yep have removed the line, and still the same error : (
0
merowingerCommented:
I've no idea :) What happens when you just execute this line?

Set objShell = CreateObject("Wscript.Shell")
wscript.echo objShell.RegRead("HKLM\SOFTWARE\McAfee\AVEngine\AVDatVersion")
0
xP3000Author Commented:
same error : (
0
merowingerCommented:
could you please past a screenshot of the regkey?

Can you just execute this line? It could be a basic problem with executing vbscript files.


wscript.echo "test"
0
xP3000Author Commented:
the wscript.echo "test" works fine! sure ill do it now!
DatVersion.jpg
ProductVersion.jpg
0
merowingerCommented:
is there a space in the name of the AVDatVersion reg key name?
For me it's working
0
xP3000Author Commented:
nah there's no space in the name, i just seem to keep getting that error :(, just tired it on another machine aswel running windows 2000
0
merowingerCommented:
can you query another key for testing purpose. e.g. a string value
0
xP3000Author Commented:
ok, i have now got it working!

apart from it doesnt like saving anything to a mapped file or network drive
0
xP3000Author Commented:
fixed it  : )

i was missing the "\" on the script!
0
merowingerCommented:
great.Is it working?
0
xP3000Author Commented:
Thanks! Great Script
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Anti-Virus Apps

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.