Const HKEY_LOCAL_MACHINE = &H80000002
Const ForReading = 1
Dim shell
set shell=createobject("wscript.shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\scripts\EPO.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.Readline
Path = ("\\" & strComputer & "\c$\Program Files\Network Associates\Common
Framework\FrameworkService.exe")
version = objFSO.GetFileVersion (Path)
Text = "3.6.0.546"
If version = text Then
WScript.Echo "Versions are equal"
Else
WScript.Echo "Versions are not equal"
End If
Wscript.Echo strComputer & " EPO File Version is " & objFSO.GetFileVersion
(Path)


' ======================= Get McAfee Version ===============================

strKeyPath = "Software\McAfee\DesktopProtection"
strValueName = "szProductVer"
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocator.ConnectServer(Machine, "Root\DEFAULT", strAdminUser,
strAdminPass)
Set oRegistry = oService.Get("StdRegProv")
strKeyPath = "Software\McAfee\DesktopProtection"
strValueName = "szProductVer"
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath,
strValueName,strValue
WScript.Echo strComputer & " McAfee Version: " & strValue
Loop

objTextFile.Close

The Script run fineso far but I want to add the following:

If version = text Then
WScript.Echo "Versions are equal"
Else
run batch file on the remote machine --- I do not know how to excute a batch
file on the remote machine
End If

Re: Check verion if version not euql run batch file by Albert

Albert
Thu Mar 20 10:54:08 CDT 2008

Freddy,

Go get the "Ps Tools" from sysinternals. (Now owned by micrsoft)
http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

The utility you want to use is called 'psexec'.

Good luck!


"freddy" <freddy@discussions.microsoft.com> wrote in message
news:5B104C1F-2C41-449A-BF72-589EEB32F9DF@microsoft.com...
>
> Const HKEY_LOCAL_MACHINE = &H80000002
> Const ForReading = 1
> Dim shell
> set shell=createobject("wscript.shell")
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.OpenTextFile("c:\scripts\EPO.txt", ForReading)
> Do Until objTextFile.AtEndOfStream
> strComputer = objTextFile.Readline
> Path = ("\\" & strComputer & "\c$\Program Files\Network Associates\Common
> Framework\FrameworkService.exe")
> version = objFSO.GetFileVersion (Path)
> Text = "3.6.0.546"
> If version = text Then
> WScript.Echo "Versions are equal"
> Else
> WScript.Echo "Versions are not equal"
> End If
> Wscript.Echo strComputer & " EPO File Version is " & objFSO.GetFileVersion
> (Path)
>
>
> ' ======================= Get McAfee Version
> ===============================
>
> strKeyPath = "Software\McAfee\DesktopProtection"
> strValueName = "szProductVer"
> Set oLocator = CreateObject("WbemScripting.SWbemLocator")
> Set oService = oLocator.ConnectServer(Machine, "Root\DEFAULT",
> strAdminUser,
> strAdminPass)
> Set oRegistry = oService.Get("StdRegProv")
> strKeyPath = "Software\McAfee\DesktopProtection"
> strValueName = "szProductVer"
> oRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath,
> strValueName,strValue
> WScript.Echo strComputer & " McAfee Version: " & strValue
> Loop
>
> objTextFile.Close
>
> The Script run fineso far but I want to add the following:
>
> If version = text Then
> WScript.Echo "Versions are equal"
> Else
> run batch file on the remote machine --- I do not know how to excute a
> batch
> file on the remote machine
> End If
>



RE: Check verion if version not euql run batch file by CoreyThomasMCSEMCSAMCDBA

CoreyThomasMCSEMCSAMCDBA
Thu Mar 20 13:12:02 CDT 2008

Hi Freddy,

We have a very similar script that is doing the same thing (checking for
McAfee and installing a newer version). We run it as part of the global
domain script since it's so important. We also use SMS to push it out.

By adding a script to install it as part of the domain policy, any time a
machine is added to the domain, the script runs and it gets the install
before SMS kicks off. Depending on how your network is setup, that could be
some time.

If you don't want to attach it to your domain script, you can kick it off as
part of a normal login script, GPO, or old school methods like tasks. In the
past, we would copy the script and and batch file over to each machine and
then set a task to kick off the batch file.

There are other methods you can use to run scripts on machines using WMI but
I typically stay away from those because of security concerns.

-Corey
http://vbscripter.blogspot.com

"freddy" wrote:

>
> Const HKEY_LOCAL_MACHINE = &H80000002
> Const ForReading = 1
> Dim shell
> set shell=createobject("wscript.shell")
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.OpenTextFile("c:\scripts\EPO.txt", ForReading)
> Do Until objTextFile.AtEndOfStream
> strComputer = objTextFile.Readline
> Path = ("\\" & strComputer & "\c$\Program Files\Network Associates\Common
> Framework\FrameworkService.exe")
> version = objFSO.GetFileVersion (Path)
> Text = "3.6.0.546"
> If version = text Then
> WScript.Echo "Versions are equal"
> Else
> WScript.Echo "Versions are not equal"
> End If
> Wscript.Echo strComputer & " EPO File Version is " & objFSO.GetFileVersion
> (Path)
>
>
> ' ======================= Get McAfee Version ===============================
>
> strKeyPath = "Software\McAfee\DesktopProtection"
> strValueName = "szProductVer"
> Set oLocator = CreateObject("WbemScripting.SWbemLocator")
> Set oService = oLocator.ConnectServer(Machine, "Root\DEFAULT", strAdminUser,
> strAdminPass)
> Set oRegistry = oService.Get("StdRegProv")
> strKeyPath = "Software\McAfee\DesktopProtection"
> strValueName = "szProductVer"
> oRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath,
> strValueName,strValue
> WScript.Echo strComputer & " McAfee Version: " & strValue
> Loop
>
> objTextFile.Close
>
> The Script run fineso far but I want to add the following:
>
> If version = text Then
> WScript.Echo "Versions are equal"
> Else
> run batch file on the remote machine --- I do not know how to excute a batch
> file on the remote machine
> End If
>