#162954 - 2006-06-06 09:06 PM
Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
Ok, I have been trying to get my login script to run a check of the Norton antivirus version, then either install or upgrade to 10.1.0.394. On the next running of the script it should install a patch to 10.1.0.396. It works sometimes, but not always.
Here is the portion of the script that I am trying to make work: ;Norton Install and Upgrade
$NAVHome = ReadValue($RegPath+'HKLM\software\INTEL\LANDesk\VirusProtect6\CurrentVersion\', 'Home Directory')
$NavExecutable = GETFILEVERSION($NAVHome +'\vpc32.exe','ProductVersion')
Select
Case $NavExecutable < "10.1.0.394" or "" RUN "\\$server_name\vphome\clt-inst\win32\setup.exe /S /v/qn"
Case $NavExecutable = "10.1.0.394" RUN "msiexec /update \\$server_name\netlogon\sav396.msp /passive /qr /norestart"
Case 1
EndSelect
? "TestNav complete..."
Sleep 2
:Norton Upgrade ends
Anyone see anything that would cause this NOT to run.
All users are accessing the script from the server (W2K). All user machines are either W2K or WXP. All users have permissions to the netlogon folder and are administrators on their local machines.
The rest of the script runs as advertised...
Thanks for any suggestions.
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162955 - 2006-06-06 10:01 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
Thank anyway! As I suspected it was a simple thing that I was missing.
I had the line: $server_name=dfow2k015
and it should be $server_name = "dfow2k015"
Works like a charm now.
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162956 - 2006-06-06 10:05 PM
Re: Script not running correctly!
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
What doesn't run? You do not have any logging in your "Case 1" section and therefore would not know if you ended up going that route.
|
Top
|
|
|
|
#162957 - 2006-06-06 10:09 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
True enough. I hadn't gotten to logging anything yet. But I thought it was always better to have a "Null" at the end of the select.
Any suggestions?
Thanks,
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162959 - 2006-06-07 10:07 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
Ok, I took out the $regpath.
Quick question about this code:
In the statement Case $NavExecutable < "10.1.0.394"
Kix interprets "10.1.0.394" as an integer, correct? Somoene looking at my script said that it may be adding all the numbers up and using that for the < argument. I say it is an integer. Who's right?
Thanks again.
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162962 - 2006-06-07 11:05 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
Ok, I think I understand what you are saying. So, if it is treating it as a string, does the < work? It seems to, I have done some debugging and testing with other text such as: Case $NavExecutable < "10.1.0.394" or $NavExecutable = "" RUN "\\$server_name\vphome\clt-inst\win32\setup.exe /S /v/qn" ? "Norton is Not Up-to-Date, Installing now. The system will reboot automatically!" Sleep 5
Case $NavExecutable = "10.1.0.394" RUN "msiexec /update \\$server_name\netlogon\sav396.msp /passive /qr /norestart" ? "Norton is Not Up-to-Date, Patching now..." Sleep 4
And it seems to work fine.
However I am noticing that still quite a few machines with older versions are not updating.
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162965 - 2006-06-08 02:10 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
ok, this explains some things. For instance; I currently have clients runnning 10.0.2.2000 that don't seem to be upgrading. This presents another challenge: How do I get them to be seen as less than 10.1.0.394? isn't there a way to tell Kix that the string is an integer, or to look past the "." in the string?
Thanks again for helping me understand this...
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162966 - 2006-06-08 03:49 PM
Re: Script not running correctly!
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
when dealing with version numbers such as you have, I would suggest writing a UDF that split the version strings of the actual verion and the version to compare into arrays of numbers. Each array element could then be compared as numbers and you would get a valid comparisions of version numbers.
|
Top
|
|
|
|
#162968 - 2006-06-08 08:48 PM
Re: Script not running correctly!
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I offer the following up for conversation... Code:
break on
iif( CompareVersions("10.0.1.123", ">", "10.0.1.123.1"), "True", "False")
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
[updated function]
Edited by Howard Bullock (2006-06-09 01:54 PM)
|
Top
|
|
|
|
#162971 - 2006-06-08 10:04 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
Here is what i have come up with that so far is working even for older versions:
$NAVHome = ReadValue("HKLM\software\INTEL\LANDesk\VirusProtect6\CurrentVersion\", "Home Directory")
$NavExecutable = GETFILEVERSION($NAVHome +"\vpc32.exe","ProductVersion")
$ver1 = (SUBSTR($NavExecutable, 8, 1)) $ver2 = (SUBSTR($NavExecutable, 10, 1)) Select
Case $ver1 < 3 RUN "\\$server_name\vphome\clt-inst\win32\setup.exe /S /v/qn"
Case $ver2 = 4 RUN "msiexec /update \\$server_name\netlogon\sav396.msp /passive /qr /norestart"
EndSelect
This solves the issue of listing each of the known versions, (5 on our systems) that all need to be updated, (with much less typing ). And also gives me the flexibility to easily modify these lines for other programs in the future.
Thoughts? Comments?
Tell me it's all jacked up, I can take it...
_________________________
If you're not livin' on the edge, you're takin' up too much space!
|
Top
|
|
|
|
#162973 - 2006-06-08 11:09 PM
Re: Script not running correctly!
|
ntw0rk
Fresh Scripter
Registered: 2003-07-03
Posts: 15
Loc: Orlando, FL
|
Wow!
Ok, Now that works well! and is still fairly easily modifiable!
I will test in my environment and let you know!
Thanks very much!
_________________________
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 920 anonymous users online.
|
|
|