Avatar of Sn0oP
Sn0oP asked on

VBScript to check to see if the Symantec Services are running, the parent server and the current definitions

Is there a possibility of a vbscript that checks remote machines if the symantec services are running what parent server they have and what virus definitions?
VB Script

Avatar of undefined
Last Comment
Sn0oP

8/22/2022 - Mon
ASKER
Sn0oP

Wrong # of points, this should be the correct amount for this kind of script.

thank you in advance

Adrian Raduti
Tompa99

Hi

Not a complete sollution for you but this script may get you started.
Change to strComputer and strService to correct server and Service Name

Regards Tompa
Dim strComputer
Dim objFileSystemObject 
Dim strService
Dim State
strComputer = "server" ' Server Name
strService = "servicename" ' Service Name
Set objComputer = GetObject("WinNT://" & strComputer &",computer")
Set objService = objCOmputer.GetObject("service", strService)
select CASE objService.Status
	Case "1" State = "Stopped"
	Case "4" State = "Running"
end select 
if State = "" then State = "Unknown"
 
Set objFileSystemObject = WScript.CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystemObject.GetFile("\\"& strComputer  & "\c$\Program Files\Common Files\Symantec Shared\virusDefs\definfo.dat")
 
Msgbox objService.Name & " " & State & "  Virus Definition lastupdated = " & objFile.DateLastModified

Open in new window

ASKER
Sn0oP

It's  great!

Just two more things...

How can I scan a list of ips and how to output the results to an csv,xls, txt whatever:-)
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
Sn0oP

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Tompa99

Hello,

Here you have one ide on how to solve it.

Regards Tompa
' Global Variables
' ****************
strComputer = "58.2.180.139"
Dim status 
' Create Log File
'****************
' Get Script Path
Set filesys = CreateObject("Scripting.FileSystemObject")
scriptPath = Left(WScript.ScriptFullName,InstrRev(WScript.ScriptFullName,".") -1)
logName = scriptPath & "_" & "log.txt"
Set logFile = filesys.CreateTextFile(logName, True)
logFile.WriteLine Now() & vbCrLf & strComputer & vbCrLf & "********************"
logFile.WriteLine("Service: " &  vbTab & vbtab & "Status: ") 
 
' Check SAV processes
' *******************
Call CheckService(strComputer,"Symantec AntiVirus")
Call CheckService(strComputer,"DefWatch") 
Call CheckService(strComputer,"ccEvtMgr")
Call CheckService(strComputer,"ccSetMgr")
Call CheckService(strComputer,"SPBBCSvc")
 
logFile.Write(status)
 
' Check Process Sub
' *****************
Sub CheckService(strComputer,strService)
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colServiceList = objWMIService.ExecQuery _
        ("Select * from Win32_Service where Name = '" & strService & "'")
 
    If colServiceList.Count = 0 Then
		Status = status & strService & vbtab & vbtab & "!~ERROR~! - Service Doesn't Exist!"  & vbcrlf
        Exit Sub
    End If
    For Each objService in colServiceList
        If objService.State = "Running" Then
			Status = status & strService & vbtab & vbtab &"OK - " & objService.State  & vbcrlf
        Else
			Status = status & strService & vbtab & vbtab &"!~ERROR~! - " & objService.State  & vbcrlf
        End If
 
    Next
End Sub
Set objFileSystemObject = WScript.CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystemObject.GetFile("\\"& strComputer  & "\c$\Program Files\Common Files\Symantec Shared\virusDefs\definfo.dat")
logFile.WriteLine("Virus Definition lastupdated = " & objFile.DateLastModified)

Open in new window

ASKER
Sn0oP

would love if anyone could help with multiple hosts scans...

Basicaly giving a list of subnets and the script above scans all ips...


Thank you for your help
Adrian Raduti
Tompa99

Hello,

Create one new question about that problem if this one is solved in your opinion.

Regards Tompa
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Sn0oP

it is not solved... otherwise I would have  created another q...

I appreciate your help but my initial help-req is not done.

Thanks again

Adrian
Tompa99

Hello,

Is it the parent server that i's left to solve or is it more? Regarding that problem I have no sollution :(

Regards Tompa
"Happy scripting"
ASKER
Sn0oP

nobody that can help me with a complete script?

Please :-(
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck