Solved

VB script to check Symantec is installed or not

Posted on 2012-03-14
1
349 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now