Link to home
Start Free TrialLog in
Avatar of Leo
LeoFlag for Australia

asked on

VB script to find Sophos EndPoint installed on network computer

Hi All, I need help to amend a VB script, the script will check two things, computers on the network for an application  if its installed, i.e. Sophos EndPoint, and which version its running.
Once checked if its running Sophos and which version it will send the results through email.
I have attached the script so far what i have worked on.... it does work and reports if any computers doesn't have sophos, but iam not able to find out the version installed through script....need help in that....
i have attached the script......
Script.txt
Avatar of jkaios
jkaios
Flag of Marshall Islands image

Try the GetFileVersion method of the File System Object:

objMessage.TextBody = objNetwork.Username & " " & strIP & " File Version: " & objFSO.GetFileVersion(strFile)

Open in new window

Avatar of Leo

ASKER

Where i should insert it?
and in the GetFileVersion, where do i have to specify it should be only checking the file version for Sophos?
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Leo

ASKER

thanks, its working :-)
can you please tell me briefly how the script is working? then i will close off the ticket.
all I did was combine all of the items that are common and only separate out the ones that are different i.e. processor architecture.
Avatar of Leo

ASKER

ok, but how does it retrieve information for Sophos installed on computers?
here is a script for getting the version

doesnt gather ip network information though

checks "Programs and Features" Installed list

Option Explicit

Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE 
	
Dim objMessage : Set objMessage = CreateObject("CDO.Message") 	
Dim objNetwork : Set objNetwork = CreateObject("WScript.Network")
Dim strComputer
Dim Architecture
Dim objReg
Dim strKey
Dim arrSubkeys
Dim strSubkey
Dim intRet1
Dim strDisplayName 
Dim intVersionMajor
Dim intVersionMinor
Dim strProgramDisplayName
Dim intProgramVersionMajor
Dim intProgramVersionMinor


strComputer = objNetwork.ComputerName 

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" 

objReg.EnumKey HKLM, strKey, arrSubkeys 

'WScript.Echo "Installed Applications" & VbCrLf 
For Each strSubkey In arrSubkeys 
	intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, "DisplayName", strDisplayName) 
	If intRet1 <> 0 Then 
		objReg.GetStringValue HKLM, strKey & strSubkey, "QuietDisplayName", strDisplayName 
	End If 
	objReg.GetDWORDValue HKLM, strKey & strSubkey, "VersionMajor", intVersionMajor
	objReg.GetDWORDValue HKLM, strKey & strSubkey, "VersionMinor", intVersionMinor

	On Error Resume  Next
	'WScript.Echo strDisplayName
	On Error Goto 0
	If InStr(1, strDisplayName, "sophos", 1) Then 
		strProgramDisplayName = strDisplayName
		intProgramVersionMajor = intVersionMajor
		intProgramVersionMinor = intVersionMinor
	End If
Next 

If strProgramDisplayName <> "" Then
	WScript.Echo VbCrLf & "Display Name: " & strProgramDisplayName
	WScript.Echo "Version: " & intProgramVersionMajor & "." & intProgramVersionMinor
			
	objMessage.Subject = "Sophos installed" 
	objMessage.TextBody = objNetwork.Username & " " & strComputer & VbCrLf & "Display Name: " & strProgramDisplayName & VbCrLf & "Version: " & intProgramVersionMajor & "." & intProgramVersionMinor
Else
	objMessage.Subject = "Sophos not installed" 
	objMessage.TextBody = objNetwork.Username & " " & strComputer
End If

objMessage.From = strComputer & "@EmailServer" 
objMessage.To = "test1@EmailServer" 

objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.EmailServer"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update

objMessage.Send

Open in new window