?
Solved

VB script to check Symantec is installed or not

Posted on 2012-03-14
1
Medium Priority
?
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

770 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