#162975 - 2006-06-09 05:11 AM
Re: Script not running correctly!
|
Howard Bullock
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.
|
Top
|
|
|
|
#162976 - 2006-06-09 05:35 AM
Re: Script not running correctly!
|
Howard Bullock
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
|
Top
|
|
|
|
#162978 - 2006-06-09 08:01 AM
Re: Script not running correctly!
|
NTDOC
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
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
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
|
Top
|
|
|
|
#162982 - 2006-06-11 01:54 AM
Re: Script not running correctly!
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
so there is...
|
Top
|
|
|
|
#162983 - 2006-06-12 01:11 PM
Re: Script not running correctly!
|
ntw0rk
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 255 anonymous users online.
|
|
|