Page 2 of 2 <12
Topic Options
#162974 - 2006-06-08 11:16 PM Re: Script not running correctly!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just in case there comes version 11 or 10.2.x.x you probably should check for those too.
so, the last if line would be:
if 10=$NavExecutable[0] and 1=$NavExecutable[1] and 0=$NavExecutable[2] and 394=$NavExecutable[3]

or even:
if "10.1.0.394" = join($NavExecutable,".")
_________________________
!

download KiXnet

Top
#162975 - 2006-06-09 05:11 AM Re: Script not running correctly!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
And then you will need to alter, alter, alter...

I am sure that the UDF above can be golfed and improved. Overall it is a genric solution that would work with any range of versions without modification other then setting your approved version.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#162976 - 2006-06-09 05:35 AM Re: Script not running correctly!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Code:
$InstalledProductVer = ReadValue('HKLM\SOFTWARE\Network Associates\TVD\VirusScan Enterprise\CurrentVersion\', 'szProductVer')
$ApprovedVersion = "8.0.0.912"
?
if CompareVersions($InstalledProductVer, "<", $ApprovedVersion)
"We need to run an install or upgrade" ?
"TRUE - " + $InstalledProductVer + " < " + $ApprovedVersion ?
RUN "\\" + $servername + "\" + $sharename + "\YourInstallprogram.exe"
else
"No upgrade necessary" ?
"FALSE - " + $InstalledProductVer + " < " + $ApprovedVersion ?
endif
?

;Other examples:

dim $signs, $sign, $Version1, $Version2
$signs = "<", ">", "="
$Version1 = "10.0.1.123"
$Version2 = "10.0.1.9"
for each $sign in $signs
iif( CompareVersions($Version1, $sign, $Version2), "True - ", "False - ")
'"' + $Version1 + '" ' + $sign + ' "' + $Version2 + '"'
?
next

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#162977 - 2006-06-09 07:48 AM Re: Script not running correctly!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Howard, in your last example I guess I'm not following you or it's broken. I get this back as the return for KiXtart 4.52RC1

True - "10.0.1.123" < "10.0.1.9"
True - "10.0.1.123" > "10.0.1.9"
True - "10.0.1.123" = "10.0.1.9"

Top
#162978 - 2006-06-09 08:01 AM Re: Script not running correctly!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Just as an FYI since you're dealing with Symantec Antivirus.

Here are a couple of UDFs that are a bit old now but were written for Symantec Corporate AV a while back.


GetNavDate() - Returns DEF dates of Symantec AV
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=113134


GetNavAntiVirusInfo() - Returns Information and Date of installed Symantec AntiVirus
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=83565

Maybe give you some other ideas to ponder.

Example output with NO change in code since 2003


Host Name: A
Engine Ver: 10.0.2.2000
Def Date: 2006/06/08
Age of Definition Files: 0
Parent Server:
Client Type: Stand-alone Client
Install Folder: C:\Program Files\Symantec AntiVirus\
Confirm Installation: 0

Top
#162979 - 2006-06-09 01:21 PM Re: Script not running correctly!
ntw0rk Offline
Fresh Scripter

Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
Well, I took Jooel's script as I said and began testing yesterday late afternoon. So far, so good! I modified it to include one other version that has to be patched. (apparently my agency bought 2 different enterprise versions!)

This is what I have running right now:

Code:

$NAVHome = ReadValue($RegPath+'HKLM\software\INTEL\LANDesk\VirusProtect6\CurrentVersion\', 'Home Directory')
$NavExecutable = split(GETFILEVERSION($NAVHome +'\vpc32.exe','ProductVersion'),".")

if ubound($NavExecutable)<3
RUN "\\$server_name\vphome\clt-inst\win32\setup.exe /S /v/qn"
else
if 10>$NavExecutable[0] or 1>$NavExecutable[1]
RUN "\\$server_name\vphome\clt-inst\win32\setup.exe /S /v/qn"
else
if 0=$NavExecutable[2] and 394>$NavExecutable[3]
RUN "\\$server_name\vphome\clt-inst\win32\setup.exe /S /v/qn"
else
if 0=$NavExecutable[2] and 394=$NavExecutable[3]
RUN "msiexec /update \\$server_name\netlogon\sav396.msp /passive /qr /norestart"
else
if 0=$NavExecutable[2] and 400=$NavExecutable[3]
RUN "msiexec /update \\$server_name\netlogon\sav401.msp /passive /qr /norestart"
endif
endif
endif
endif
endif



I have another site that is running the same script, (they have more of the .400 version) so I will get an idea if there are any hang-ups.

Thanks again Jooel!
_________________________
If you're not livin' on the edge, you're takin' up too much space!

Top
#162980 - 2006-06-09 01:49 PM Re: Script not running correctly!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
That is quite interesting as I get the following with 4.50 and 4.52rc1:

c:\data\scripts>..\kix\kix.450\kix32 compareversions.kix

No upgrade necessary
FALSE - 8.0.0.912 < 8.0.0.912

False - "10.0.1.123" < "10.0.1.9"
True - "10.0.1.123" > "10.0.1.9"
False - "10.0.1.123" = "10.0.1.9"

Just in case I changed something in the UDF I will repost it.

Code:
function CompareVersions($version1, $comparison, $version2, optional $split)
dim $Ver1array, $Ver2array, $Ver1arrayCnt, $Ver2arrayCnt
dim $index, $maxindex

if VarTypeName($split) <> "String" $split = "." endif

$Ver1array = split($version1, $split)
$Ver1arrayCnt = ubound ($Ver1array)

$Ver2array = split($version2, $split)
$Ver2arrayCnt = ubound ($Ver2array)

Select
case $Ver1arrayCnt <= $Ver2arrayCnt
$maxindex = $Ver2arrayCnt
redim preserve $Ver1array[$maxindex]
case $Ver1arrayCnt > $Ver2arrayCnt
$maxindex = $Ver1arrayCnt
redim preserve $Ver2array[$maxindex]
case 1
;something is wrong
EndSelect

$CompareVersions = 1
for $index = 0 to $maxindex
dim $difference

$difference = val($Ver2array[$index]) - val($Ver1array[$index])

Select
case $comparison = "="
if $version1 <> $version2
$CompareVersions = 0
$index = 1+$maxindex
endif
case $comparison = "<"
if $difference < 0 or $version1 = $version2
$CompareVersions = 0
$index = 1+$maxindex
endif
case $comparison = ">"
if $difference > 0 or $version1 = $version2
$CompareVersions = 0
$index = 1+$maxindex
endif
Endselect
next
endfunction

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#162981 - 2006-06-10 05:23 AM Re: Script not running correctly!
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
There's already a CompareVersions() - Compares two multi-segment version strings :-)

Edited by sealeopard (2006-06-15 04:18 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#162982 - 2006-06-11 01:54 AM Re: Script not running correctly!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
so there is...
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#162983 - 2006-06-12 01:11 PM Re: Script not running correctly!
ntw0rk Offline
Fresh Scripter

Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
So does that mean that there is an easier way to write that, or is that the way that Howard wrote it?
_________________________
If you're not livin' on the edge, you're takin' up too much space!

Top
#162984 - 2006-06-12 01:34 PM Re: Script not running correctly!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Jens,

Your link does not work.

NetwOrk,

Here is the UDF Jens is talking about.
CompareVersions() - Compares two multi-segment version strings
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 718 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.061 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org