#186513 - 2008-03-27 07:41 PM
Determine version of MS Office installed
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
I'm trying to get an idea for who in the office is running something less than MS Office 2003. Is there a reg key or something I can query to determine not only the version of Office running on the client, but the service pack level? Thanks!
|
Top
|
|
|
|
#186515 - 2008-03-27 11:17 PM
Re: Determine version of MS Office installed
[Re: Glenn Barnas]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Yep, posted a couple of them.
This is probably the one you would want. GetOfficeDetails2()
This is the main page for the UDFs where you can find over 600 pre-written script functions.
UDF Library
|
Top
|
|
|
|
#186518 - 2008-03-28 10:00 AM
Re: Determine version of MS Office installed
[Re: NTDOC]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
If you want to do it yourself
- Recurse through "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
- Find all the Data for the Value names "DisplayName"
- Look with InStr() for "Microsoft Office"
- If found, get the Values you need (p.e. the DisplayName and the DisplayVersion)
|
Top
|
|
|
|
#186522 - 2008-03-28 03:46 PM
Re: Determine version of MS Office installed
[Re: Witto]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
okay, i like that method. can you remind me how i "recurse" through that key to make the match on Microsoft Office in the Display Name field and then to also return the DisplayVersion? thanks.
|
Top
|
|
|
|
#186524 - 2008-03-28 04:15 PM
Re: Determine version of MS Office installed
[Re: endodave]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
or, using the function, this is what i am doing and it is not working:
Dim $MSO_Ver $MSO_Ver = GetOfficeDetails2() $rc Open (9, "\\servershare\Office_Versions.csv", 5) $rc = writeline (9, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $MSO_Ver + @CRLF) $rc = close(9)
it's telling me "this type of array not supported in expressions." any idea?
|
Top
|
|
|
|
#186525 - 2008-03-28 04:24 PM
Re: Determine version of MS Office installed
[Re: endodave]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
okay, i was able to get it to output to the screen by this:
for each $item in GetOfficeDetails2() ? $item next
however, the output is this:
10.0.6789.0 10.0.6802.0 10.0.6819.0 10.0.6771.0
10.0.6615.0
Microsoft Office XP Professional
What does all that mean?
|
Top
|
|
|
|
#186535 - 2008-03-28 05:56 PM
Re: Determine version of MS Office installed
[Re: endodave]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
;************************************************************************* ; Script Name: FindUninstallStrings.kix ; Author: Wim Rotty ; Date: 28/03/2008 ; Description: Find the Uninstall Strings containing "Microsoft Office" ;*************************************************************************
;Script Options If Not @LOGONMODE Break On Else Break Off EndIf Dim $RC ;$RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf
;Declare variables Dim $UninstallKey, $Count, $Key, $Value
;Initialize variables $UninstallKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $Count = 0
;Code $Key = EnumKey($Uninstallkey, $Count) While @ERROR = 0 ;? $Key $Value = ReadValue($Uninstallkey+'\'+$Key,"DisplayName") If InSTR($Value, "Microsoft Office") ? $Value ? ReadValue($Uninstallkey+'\'+$Key,"DisplayVersion") ? EndIf $Count = $Count + 1 $Key = EnumKey($Uninstallkey, $Count) Loop
;Personal UDF Section
;UDF Section |
|
Top
|
|
|
|
#186543 - 2008-03-28 07:30 PM
Re: Determine version of MS Office installed
[Re: Witto]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
this works beautifully. thanks!
|
Top
|
|
|
|
#193743 - 2009-05-08 10:06 PM
Re: Determine version of MS Office installed
[Re: endodave]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
so, while this works great, i'm now trying to exclude a workstation from running this portion of the script. Here's how I'm doing it and it's not working. Any idea?
IF WKSTA <> name
Dim $RC
;$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
$RC = SetOption("WrapAtEOL", "On")
EndIf
;Declare variables
Dim $UninstallKey, $Count, $Key, $Value
;Initialize variables
$UninstallKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$Count = 0
;Code
$Key = EnumKey($Uninstallkey, $Count)
While @ERROR = 0
;? $Key
$DispName = ReadValue($Uninstallkey+'\'+$Key,"DisplayName")
$DispVer = ReadValue($Uninstallkey+'\'+$Key,"DisplayVersion")
If InSTR($DispName, "Microsoft Office")
$rc = Open (9, "\\irvineefa01\kixtart_log\Office_Versions.csv", 5)
$rc = writeline (9, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $DispName + "," + $DispVer + "," + $item + @CRLF)
$rc = close(9)
EndIf
$Count = $Count + 1
$Key = EnumKey($Uninstallkey, $Count)
Loop
ENDIF
Edited by NTDOC (2009-05-11 11:02 PM) Edit Reason: Added code tags
|
Top
|
|
|
|
#193747 - 2009-05-09 03:34 PM
Re: Determine version of MS Office installed
[Re: Gargoyle]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
You could also experience a problem with your WriteLine if items such as "@FULLNAME" contains a comma. You should use a "real" CSV format, which detects any data that contains commas and encloses them in quotes. Look for the CSV function, which translates between an array of data and a CSV formatted string. Using it, you can do something like $CSVarray = @TIME, @DATE, @WKSTA, @USERID, @fullname, $DispName, $DispVer, $item
$Rc = WriteLine(9, CSV($CSVarray) + @CRLF) Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#193772 - 2009-05-11 10:48 PM
Re: Determine version of MS Office installed
[Re: endodave]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
hi, i put the workstation name in quotes (IF @WKSTA <> "name"), but it is still being included.
|
Top
|
|
|
|
#193800 - 2009-05-12 06:03 PM
Re: Determine version of MS Office installed
[Re: Richard H.]
|
endodave
Starting to like KiXtart
Registered: 2005-08-17
Posts: 101
|
here is the code copied from the kix file:
IF @WKSTA <> "DWF5Q8101C20"
Dim $RC
;$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
If @SCRIPTEXE = "KIX32.EXE"
$RC = SetOption("WrapAtEOL", "On")
EndIf
;Declare variables
Dim $UninstallKey, $Count, $Key, $Value
;Initialize variables
$UninstallKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$Count = 0
;Code
$Key = EnumKey($Uninstallkey, $Count)
While @ERROR = 0
;? $Key
$DispName = ReadValue($Uninstallkey+'\'+$Key,"DisplayName")
$DispVer = ReadValue($Uninstallkey+'\'+$Key,"DisplayVersion")
If InSTR($DispName, "Microsoft Office")
$rc = Open (9, "\\irvineefa01\kixtart_log\Office_Versions.csv", 5)
$rc = writeline (9, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $DispName + "," + $DispVer + "," + $item + @CRLF)
$rc = close(9)
EndIf
$Count = $Count + 1
$Key = EnumKey($Uninstallkey, $Count)
Loop
;;;;;;;;;;;;;
; ;
; End ;
; ;
;;;;;;;;;;;;;
ENDIF
Edited by Benny69 (2009-05-12 07:14 PM) Edit Reason: Added Code Tags
|
Top
|
|
|
|
#193802 - 2009-05-12 07:14 PM
Re: Determine version of MS Office installed
[Re: endodave]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Hi endodave
When you post code please place that code in code tags, here is a link that will help you with that, The Post/Reply Formatting Box and How to use it
|
Top
|
|
|
|
#194365 - 2009-06-23 05:43 PM
Re: Determine version of MS Office installed
[Re: Benny69]
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
Here is another, but it returns more data than I want...
Can I do a WHERE clause that contains OR?? Where Name="this" or name="that"?
$objWMI = GetObject("winmgmts:\\.\root\CIMV2")
$colItems = $objWMI.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office%'")
For Each $objItem In $colItems
? '1 '+ $objItem.Name
? '2 '+ $objItem.InstallLocation
? '3 '+ $objItem.Version
? '4 '+ $objItem.IdentifyingNumber
?
Next
|
Top
|
|
|
|
#194394 - 2009-06-24 03:44 PM
Re: Determine version of MS Office installed
[Re: Richard H.]
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I wound up doing this:
? @time
$objWMI = GetObject("winmgmts:\\.\root\CIMV2")
$colItems = $objWMI.ExecQuery("SELECT * FROM Win32_Product WHERE Name='Microsoft Office Enterprise 2007' or Name='Microsoft Office Professional Plus 2007'")
For Each $objItem In $colItems
? '1 '+ $objItem.Name
? '2 '+ $objItem.InstallLocation
? '3 '+ $objItem.Version
? '4 '+ $objItem.IdentifyingNumber
?
Next
? @time
$MSOKey = iif(keyexist("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90120000-0030-0000-0000-0000000FF1CE}"),'{90120000-0030-0000-0000-0000000FF1CE}','{90120000-0011-0000-0000-0000000FF1CE}')
$MSOType = readvalue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MSOKey,"DisplayName")
$MSOdir = readvalue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MSOKey,"InstallLocation")
$MSOVer = readvalue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MSOKey,"DisplayVersion")
$MSOMajor= Split($MSOVer,'.')[0]
$MSOMinor= Split($MSOVer,'.')[2]
?
? $MSOType
? $MSOdir
? $MSOver
? $MSOMajor
? $MSOMinor
?
? @time
?
? 'press enter to end'
gets $k
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 515 anonymous users online.
|
|
|