Solved

VB script to check Symantec is installed or not

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 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