Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB script to check Symantec is installed or not

Posted on 2012-03-14
1
Medium Priority
?
368 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview

610 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