Solved

VB script to check Symantec is installed or not

Posted on 2012-03-14
1
357 Views
Last Modified: 2012-03-25
Hi

I need vb script to check symantec is installed or not  and also the same script should also check the updates(symantec) are installed or not
0
Comment
Question by:roopesha2
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 37722850
Hi, I'm pretty well just making a guess at this, since I don't have Symantec, but hopefully it works.

Regards,

Rob.

'On Error Resume Next
 
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Const HKEY_LOCAL_MACHINE = &H80000002

strArchitecture = GetOSArchitecture(objWMIService)
If strArchitecture = 32 Then
	strKey = "SOFTWARE\Symantec\SharedDefs"
Else
	strKey = "SOFTWARE\wow6432node\Symantec\SharedDefs"
End If
strValueName = "DEFWATCH_10"

strComputer = "."
 
strAppName = "Symantec"
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name LIKE '%" & strAppName & "%'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
 
For Each objItem In colItems
	strProductName = objItem.Name
	strProductVersion = objItem.Version
	Set objRegistry = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer & "\root\default:StdRegProv")
	objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKey, strValueName, strData
	If strData <> "" Then
		strData = Mid(strData, InStrRev(strData, "\") + 1)
		strDefVersion = Mid(strData, 7, 2) & "-" & MonthName(Mid(strData, 5, 2), True) & Left(strData, 4) & " rev " & Mid(strData, InStrRev(strData, ".") + 1)
	Else
		strDefVersion = "Unknown"
	End If
	WScript.Echo """" & strComputer & """,""" & strProductName & """,""" & strProductVersion & """,""" & strDefVersion & """"
Next

WScript.Echo "Done"

Function GetOSArchitecture(objRemote)
	' TITLE: GetOSArchitecture
	' DESCRIPTION: This function will use a WMI query to determine the system
	'	architecture of the target computer
	' INPUT:
	'	objRemote must be an object that is bound to the WMI service on the target machine
	'	Make a call such as Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
	'	and pass objWMI to this function
	' OUTPUT:
	'	A string value being 32 or 64
	Set colOS = objRemote.ExecQuery("SELECT OSArchitecture FROM Win32_OperatingSystem",, 48) 
    For Each objOS In colOS 
        intAddressWidth = objOS.OSArchitecture
    Next
    If intAddressWidth = "32-bit" Then intAddressWidth = 32
    If intAddressWidth = "64-bit" Then intAddressWidth = 64
    GetOSArchitecture = intAddressWidth
End Function

Open in new window

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question