Lori Paull
(Fresh Scripter)
2002-04-26 06:56 PM
O2K SR-2 Install Depending on Current Version of Winword

I have not done a lot of complicated scripting, so please be patient! I am trying to install Office 2000 SR-2 on workstations that are currently at the SP1 level. I have looked at various examples and seem to have tried them all, but they will not work. I am basing my install on the current version of the winword.exe file -- if it's not 9.0.0.4527. Below is the code I am using in my subroutine. The actual installation of the SR2 works fine, but it wants to install it no matter what.
==================================================
code:
:O2K_SR2
$currentfilever = "9.0.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","Path")
IF getfileversion($winpath,"FileVersion") < $currentfilever
GOSUB ASSIGN_UTILITY_DRIVE
MESSAGEBOX("Please be patient. This process takes a minute to display its progress, and may take up to 15 minutes to install. Please do not open any applications until the installation is complete and your machine restarts. Click OK to continue.","Installing Office 2000 SR-2",16,0)
CLS
Run "U:\Upgrades\SP2\sp2upd.exe /q"
Exit 0
Endif
Return

==================================================

Thanks for any help you can give me, and as soon as possible. I'm about at my wits end!

[ 26 April 2002, 19:04: Message edited by: Lori Paull ]


BrianTX
(Korg Regular)
2002-04-26 09:29 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

I think I see your problem.

Try this:

code:
:O2K_SR2$
currentfilever = "9.0.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","")
IF getfileversion($winpath,"FileVersion") < $currentfilever
GOSUB ASSIGN_UTILITY_DRIVE
MESSAGEBOX("Please be patient. This process takes a minute to display its progress, and may take up to 15 minutes to install. Please do not open any applications until the installation is complete and your machine restarts. Click OK to continue.","Installing Office 2000 SR-2",16,0)
CLS
Run "U:\Upgrades\SP2\sp2upd.exe /q"
Exit 0
EndifReturn

I noticed that the value you're reading from the registry returns the path of winword without winword.exe appended. So, you aren't getting the version of winword.exe. If you use the (default) value (by using "" instead of "path"), you will get the full path including the winword.exe.

Brian


Kdyer
(KiX Supporter)
2002-04-27 03:36 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Lori,

It is great that you are upgrading your client to SP-2 of Office 2k. However, you know there are issues with attachments in e-mail (Outlook), right?

I know that has been addressed in 2002. I have heard that there are some tweaks to get around this.

HTH,

- Kent


Lori Paull
(Fresh Scripter)
2002-04-30 01:40 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Thanks to you both for your help and comments. Brian, I tried what you suggested, but it still is not working. When I watch it, it acts as if it's not even checking the version -- I would expect to see a little hesitation of the script when it should be checking the version and I don't. Any other ideas?

Kent, thanks for the information. We are aware of the e-mail attachments "problem."

I'm really baffled as to why this is not working.

Please help in any way you or anyone else can.

Thanks!


Radimus
(KiX Supporter)
2002-04-30 01:52 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

You can also look into the UpdateApps UDF for a convenient log and wrapper for installs.

Instead of comparing file versions, look into the uninstall keys and the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\LocalPackages
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Products

keys to determine if the package was installed

[ 30 April 2002, 01:52: Message edited by: Radimus ]


Radimus
(KiX Supporter)
2002-04-30 01:58 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

also, I believe the app exe versions don't use the "9.0.0.4527" ... try "9.0.4527"

In either case, the most common issue here is also that while the value appears to be a number, it is actually a string, and will be evaluated as one. Try using instr or = to positively ID the version value


Dean R
(Starting to like KiXtart)
2002-04-30 01:13 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Email attachments problem?
Are we talking about
Outlook has blocked access to the potentially blah blah blah, problem or is there one I missed?

Hmm, onwards to technet

[Big Grin]


Kdyer
(KiX Supporter)
2002-04-30 02:14 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Lori,

Can you try the following?

code:
:O2K_SR2$
currentfilever = "9.0.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","")
IF getfileversion($winpath,"FileVersion") < $currentfilever
? "Word Version is " + $winpath
SLEEP 3
GOSUB ASSIGN_UTILITY_DRIVE
MESSAGEBOX("Please be patient. This process takes a minute to display its progress, and may take up to 15 minutes to install. Please do not open any applications until the installation is complete and your machine restarts. Click OK to continue.","Installing Office 2000 SR-2",16,0)
CLS
Run "U:\Upgrades\SP2\sp2upd.exe /q"
Exit 0
Endif
Return

Dean R - In SP-2 of Outlook 2000, if a user tries to send a "potentially dangerous" attachment like a XLS, MDB, EXE file.. It is blocked by Outlook. From an IT standpoint, it is great.. However, from a user's perspective, it is a pain..

Thanks!

- Kent

[ 30 April 2002, 16:36: Message edited by: kdyer ]


BrianTX
(Korg Regular)
2002-04-30 08:48 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Hey Kent..

Typo in your script! [Smile] (I don't feel so bad.. i'm not the only one! lol)..

Second line should be?

code:
$currentfilever = "9.0.0.4527"

Brian


BrianTX
(Korg Regular)
2002-04-30 08:58 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Doh.. I think you copied MY error in my post.. sorry Kent! [Smile]

Ok.. let's try this again:
code:
:O2K_SR2
$currentfilever = "9.0.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","")
IF getfileversion($winpath,"FileVersion") < $currentfilever
GOSUB ASSIGN_UTILITY_DRIVE
MESSAGEBOX("Please be patient. This process takes a minute to display its progress, and may take up to 15 minutes to install. Please do not open any applications until the installation is complete and your machine restarts. Click OK to continue.","Installing Office 2000 SR-2",16,0)
CLS
Run "U:\Upgrades\SP2\sp2upd.exe /q"
Exit 0
Endif
Return

If this doesn't work, try running a script from the command line that looks something like this:

code:
$currentfilever = "9.0.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","")
? "The winword.exe path from the registry is: " + $winpath
? "Current file version is: " + $currentfilever
$fileversion = getfileversion ($winpath,"FileVersion")
If $fileversion < $currentfilever
? $fileversion + " is less than " + $currentfilever
else
? $fileversion + " is not less than " + $currentfilever
Endif

See what this comes out with.. it should tell you where you're going wrong.

Brian


Lori Paull
(Fresh Scripter)
2002-05-02 01:38 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

O.K. It seems the problem is that KIX (or something) can't tell if the version is less than, greater than, or equal to. I tried the last suggestion of running a batch file that showed me the version, and if it was less than (or whatever). I expanded on this and tried less than, greater than, equal to, and they all came back and said not less than, not greater than, not equal to . I tried putting <> rather than < or =, but that didn't work. I also tried grabbing the product version rather than file, but came up with the same result. Any other ideas? I also tried the suggestion about the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\LocalPackages
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Products keys, but couldn't see anything to go with on these.


Les
(KiX Master)
2002-05-02 02:14 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Running Brians latest offering on my system, returns the following:

Current file version is: 9.0.0.4527
9.0.3822 is not less than 9.0.0.4527

Obviously you're not comparing apples to apples. They do not have the same number of characters. Since it's not a 'value' compare but rather is a 'string' compare, hence the result.

What's wrong with checking for an exact match? Is there a chaance there's a newer version out there? If there is, I suggest you list all known variants in SELECT CASE statements.


Kdyer
(KiX Supporter)
2002-05-02 03:39 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Lori,

Made a change to the script..

Put "" around the Word path. Added in a VAL() statement around the $fileversion and $currentfilever (even though it appeared unecessary).

code:
break on cls
$currentfilever = "9.0.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","")
? "The winword.exe path from the registry is: " + $winpath
? "Up-to-date file version is: " + $currentfilever
$fileversion = getfileversion ("$winpath","FileVersion")
? "Version found is: " + $fileversion
If val($fileversion) < val($currentfilever)
? $fileversion + " is less than " + $currentfilever
else
? $fileversion + " is greater than " + $currentfilever
Endif

If I run this, I get:
quote:

The winword.exe path from the registry is: C:\PROGRA~1\MICROS~1\OFFICE\WINWORD.EXE
Up-to-date file version is: 9.0.0.4527
Version found is: 9.0.3822
9.0.3822 is greater than 9.0.0.4527

Can you post your results? Or, where it stops?

BTW, what version of Kixtart are you running with this?

Thanks!

- Kent

[ 02 May 2002, 03:41: Message edited by: kdyer ]


Radimus
(KiX Supporter)
2002-05-02 04:19 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

the next simplest method is to use left() to determine 97, 2000, or XP
and then use right() to pull the last 4 to determine build....

if everyone is 2000 then you could skip the left()


Sealeopard
(KiX Master)
2002-05-02 03:22 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Take a look at this UDF:
http://www.scriptlogic.com/kixtart/ViewFunction.asp?FN=VersionCompare


Radimus
(KiX Supporter)
2002-05-02 03:30 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

here is some old code I was using... before I got tired of trying to keep up with office patches...

code:
		; ****************************** MSOffice version *****************************************
$MSOdir=readvalue("$HKLMSMWCV\App Paths\excel.exe","Path")
if exist("$MSOdir\excel.exe")
$excel=getfileversion("$MSOdir\excel.exe")
select
case $excel=8.0a $esr="97 SR-1"
case $excel=8.0e $esr="97 SR-2"
case $excel=9.0.2719 $esr="2000"
case $excel=9.0.3822 $esr="2000 SR-1a"
case $excel=9.0.4430 $esr="2000 SR-2"
endselect
? " Installed "color c+/n"MS Office "color w/n"is version " color w+/n "$esr" color w/n
endif
if exist("$MSOdir\msaccess.exe")
$access=getfileversion("$MSOdir\msaccess.exe")
select
case $access=8.0.3512 $asr="97 SR-0"
case $access=8.0.4122 $asr="97 SR-1"
case $access=8.0.5903 $asr="97 SR-2"
case $access=9.0. $asr="2000"
case $access=9.0.3822 $asr="2000 SR-1a"
case $access=9.0.4506 $asr="2000 SR-2"
endselect
? " Installed "color c+/n"MS Access " color w/n"is version "color w+/n $asr color w/n
endif
if exist("$MSOdir\mspub.exe")
$pub=getfileversion("$MSOdir\mspub.exe")
select
case $pub=4.0 $psr="97"
case $pub=5.0 $psr="98"
case $pub=6.0 $psr="2000"
endselect
? " Installed "color c+/n"MS Publisher " color w/n"is version "color w+/n $psr color w/n
endif



BrianTX
(Korg Regular)
2002-05-02 03:44 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

I think if you look at winword.exe for SP2 and get a file version from it you will find the version to be: "9.0.4527" and not "9.0.0.4527". I looked at the properties on mine (sp1.. i don't like the email security crapola) it says "9.0.0.5302" in the header but if you look under the property "FileVersion" it actually is defined as "9.0.5302".. I would guess that this will work the same with SP2. If it's installing every single time (whether installed or not), then I would assume this is your problem. Once the file version matches what you're actually uses on SP2, it should work. However, you can use a <> instead of just a < for your operation.

Brian


Lori Paull
(Fresh Scripter)
2002-05-02 05:35 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

I changed the code as suggested to inlcude the VAL() statement, and I get the same results as you.
winword.exe path from the registry is: C:\PROGRA~1\MICROS~2\Office\WINWORD.EXE
Up-to-date file version is 9.0.0.4527
Version found is 9.0.3822
9.0.3822 is greater than 9.0.0.4527

What confuses me about this is if I go to Explorer and the properties, then the version tab, the Version number shows 9.0.0.3822. In the additional properties in that window the product version is what displays 9.0.3822. Also, if 9.0.3822 is greater than 9.0.0.4527, I would think that replacing the < with the > would take care of the problem, but that isn't the case.

The KIX version is 3.62.0.0.


BrianTX
(Korg Regular)
2002-05-02 05:49 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

To elaborate on my previous post, try this code:
code:
:O2K_SR2
$currentfilever = "9.0.4527"
$winpath = readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","")
IF getfileversion($winpath,"FileVersion") <> $currentfilever
GOSUB ASSIGN_UTILITY_DRIVE
MESSAGEBOX("Please be patient. This process takes a minute to display its progress, and may take up to 15 minutes to install. Please do not open any applications until the installation is complete and your machine restarts. Click OK to continue.","Installing Office 2000 SR-2",16,0)
CLS
Run "U:\Upgrades\SP2\sp2upd.exe /q"
Exit 0
Endif
Return

Notice that I changed $currentfilever to "9.0.4527" and "Path" to "" and < to <>.

Brian

[ 02 May 2002, 17:51: Message edited by: BrianTX ]


Kdyer
(KiX Supporter)
2002-05-02 11:15 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Brian,

I can see an issue with that logic.. If it is not (<>) the prescribed version whether it is less or greater, you are going to run the update anyway?

Hmmm..

- Kent


Lori Paull
(Fresh Scripter)
2002-05-03 07:54 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Thank you all for your suggestions and help. It appears everything is working the way I need it now. For some reason though the < sign works. I still don't understand why using 9.0.4527 works instead of 9.0.0.4527, when the Explorer properties show 9.0.0.4527 for file version and 9.0.4527 for product version, and I'm using "FileVersion" in getfileversion rather than "ProductVersion."

I did learn a lot. Thanks again! [Smile]


Kdyer
(KiX Supporter)
2002-05-04 12:15 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Lori,

It is a decimal place thing..

If we look at this like a comma (or period) delimited file, it works this way.

9.0.4527 9.0.0.4527
1.2.3      1.2.3

So, the way that it is treating this is that in the "3" spot, the 4 is greater than 0.

Does that help?

- Kent

[ 04 May 2002, 00:16: Message edited by: kdyer ]


LonkeroAdministrator
(KiX Master Guru)
2002-05-04 12:21 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

KENT, is this your birthday or what!?!?!?

been waiting this whole day, THOUSAND POSTS!

congrats!

keep up the work.

the slower one,


ShawnAdministrator
(KiX Supporter)
2002-05-04 12:29 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Agreed, congrats Kent, your a valued member of this Bulletin Board, keep up the great work !!!

code:
   ___                        _      
/ __|___ _ _ __ _ _ _ __ _| |_ ___
| (__/ _ \ ' \/ _` | '_/ _` | _(_-<
\___\___/_

ShawnAdministrator
(KiX Supporter)
2002-05-04 12:30 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

See above - what the keck:

code:
   ___                        _      
/ __|___ _ _ __ _ _ _ __ _| |_ ___
| (__/ _ \ ' \/ _` | '_/ _` | _(_-<
\___\___/_

ShawnAdministrator
(KiX Supporter)
2002-05-04 12:40 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

pfffttt - pfffttt - testing ... 123 ... is this
thing on ?

ok - i'll quit while im ahead. you know what i
mean right Kent ?

-Shawn


Kdyer
(KiX Supporter)
2002-05-04 12:53 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Shawn/Lonkero,

Thanks for the recognition! I have been trying to do this for a while and have been trailing Doc as well. We should see it this way, if we give to the community that helps us we all benefit!

BTW, Lonkero - You aren't too far behind to be in the limelight either!! (snicker)

Thanks again guys!

- Kent

[ 04 May 2002, 00:55: Message edited by: kdyer ]


Les
(KiX Master)
2002-05-04 02:09 AM
Re: O2K SR-2 Install Depending on Current Version of Winword

Kent,
CONGRATULATIONS and welcome to the Millenium club!
You are a great resource and an asset to our KiX community. For that I (and I'm sure everyone else) thank you.

Also thanks for explaining so eloquently to Lori what I tried and failed. When you lay it out on the page like that, it works.

The next 1000 should be easier than the first. Heck, ask Shawn. I just hope I can make the second Millenuim before he enters the third. Shawn, Buddy, wait up for me EH!


MCA
(KiX Supporter)
2002-05-22 01:17 PM
Re: O2K SR-2 Install Depending on Current Version of Winword

Dear Kent,

Also big congratulations and up to the second Millenium.
Specially thanks for great input on the FAQ forum, which you are moderating witrh Les.
greetings.