| 
| 
| 
| #210650 - 2015-09-01 12:04 AM  Get Office Details |  
| NTDOC   Administrator
 
       
   Registered:  2000-07-28
 Posts: 11627
 Loc:  CA
 | 
Is 7 years too long to get back to this :-)
 GetOfficeDetails2() UDF
 http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=109278
 
 
 Okay I had a request to get some updated Office information so I looked at this UDF script and aside from Click-To-Run virtual and Microsoft changing back to get the Outlook version from the executable like they do other office applications there really isn't much change. I suppose you could do a check for x86 vs x64 but most people use x86 everywhere I've seen. Checking if (x86) is in the App Path would tell you if it was x86 or x64 so I've not added it. Made a few changes to the code below. If you have time please try it out and let me know. I also did not check on Outlook 2010 if it was using the DLL or the EXE
 
 
 
 ; GetOfficeDetails2.kix
; 8/31/2015 2:46:58 PM Update script to test for newer Office versions
; Check if Office is Click-To-Run install and exit if it is
; (do not have Click-To-Run install so cannot code and test)
; https://msdn.microsoft.com/en-us/library/office/ff864733.aspx
; 7/17/2005 11:17PM
; Updated 7/19/2005 2:25PM
; http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=143052
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')
Dim $OfficeApps
$OfficeApps = GetOfficeDetails2()
? 'Office Type is : ' + $OfficeApps[10]
? 'Excel Version : ' + $OfficeApps[0]
? 'Word Version : ' + $OfficeApps[1]
? 'PowerPoint Version : ' + $OfficeApps[2]
? 'Access Version : ' + $OfficeApps[3]
? 'Publisher Version : ' + $OfficeApps[4]
? 'Project Version : ' + $OfficeApps[5]
? 'Visio Version : ' + $OfficeApps[6]
? 'Outlook Version : ' + $OfficeApps[7]
? 'FrontPage Version : ' + $OfficeApps[8]
? 'InfoPath Version : ' + $OfficeApps[9]
? 'Virtual Office: ' +  $OfficeApps[11]
Function GetOfficeDetails2(optional $sComputer)
  Dim $A,$B,$P,$Excelver,$Wordver,$PowerPointver,$Accessver,$Publisherver
  Dim $Projectver,$FrontPagever,$Visiover,$Outlookver,$InfoPathver
  Dim $Product,$Office,$VirtualOffice
  Dim $Officeindex,$Officekey,$DetailsArray[12]
  Dim $Index,$RP,$C,$D
  $sComputer=IIf(Not $sComputer,'','\\'+Join(Split($sComputer,'\'),'',3)+'\')
  $A=$sComputer+'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths'
  $C=$sComputer+'HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\'
  $D=$sComputer+Left(ReadValue($sComputer+'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion','CommonFilesDir'),1)
  $Index=0
  Select 
    Case KeyExist("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\14.0\Common\InstallRoot\Virtual")
      $VirtualOffice=1
      Exit
    Case KeyExist("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\15.0\Common\InstallRoot\Virtual")
      $VirtualOffice=1
      Exit
    Case 1
      $VirtualOffice=0
  EndSelect
  $B=EnumKey($A+'\',$Index)
  If @ERROR Exit @ERROR EndIf
  While @ERROR=0
    If $sComputer 
      $RP=$D+'$'+Right(ReadValue($A+'\'+$B,'path'),-2)
    Else
      $RP=ReadValue($A+'\'+$B,'path')
    EndIf
    Select
      Case $B='excel.exe'
        $Excelver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='winword.exe'
        $Wordver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='powerpnt.exe'
        $PowerPointver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='msaccess.exe'
        $Accessver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='mspub.exe'
        $Publisherver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='winproj.exe'
        $Projectver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='visio32.exe'
        $Visiover=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='outlook.exe'
        Select
          Case KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0")
            $Outlookver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
          Case 1
            $Outlookver=GetFileVersion($RP+'\'+'OUTLLIB.DLL','BinFileVersion')
        EndSelect 
      Case $B='frontpg.exe'
        $FrontPagever=GetFileVersion($RP+'\'+$B,'BinFileVersion')
      Case $B='infopath.exe'
        $InfoPathver=GetFileVersion($RP+'\'+$B,'BinFileVersion')
    EndSelect
    $Index=$Index+1
    $B=EnumKey($A+'\',$Index)
  Loop
  $Officeindex=0
  $Officekey=EnumKey($C,$Officeindex)
  If @ERROR Exit @ERROR EndIf
  While @ERROR=0 And $Office=0
    $Product=ReadValue($C+$Officekey,'DisplayName')
    If InStr ($Product, 'Microsoft Office') And Not InStr($Product,'Live Meeting') And Not InStr($Product,'Studio')
      $Office=$Product
    EndIf
    $Officeindex=$Officeindex+1
    $Officekey=EnumKey($C,$Officeindex)
  Loop
$DetailsArray[0]=$Excelver    $DetailsArray[1]=$Wordver        $DetailsArray[2]=$PowerPointver
$DetailsArray[3]=$Accessver   $DetailsArray[4]=$Publisherver   $DetailsArray[5]=$Projectver
$DetailsArray[6]=$Visiover    $DetailsArray[7]=$Outlookver     $DetailsArray[8]=$FrontPagever
$DetailsArray[9]=$InfoPathver $DetailsArray[10]=$Office        $DetailsArray[11]=$VirtualOffice
$GetOfficeDetails2=$DetailsArray
EndFunction
 |  
| Top |  |  |  |  
| 
| 
| #210651 - 2015-09-01 03:20 AM  Re: Get Office Details
[Re:  NTDOC] |  
| Allen   KiX Supporter
 
       
 Registered:  2003-04-19
 Posts: 4562
 Loc:  USA
 | 
This is blatant stealing of Lonk's code but it might be a good start...
 
 
? OfficePath
function OfficePath(optional $computer)
  dim $regview, $rootkey,$c,$s,$k,$bs[1],$b,$e
  dim $officeVersion
  $regview = setoption("wow64alternateregview","on")
  $rootkey = iif($computer,"\\"+$computer+"\","")+"hklm\software"
  $e="0011","011D","0012","0013","0014","002F","008B","002E","0030","0031","0033","0035","00CA"
  $bs="","\wow6432node"
  $c=0
  for each $b in $bs
    do
      $k = enumkey($rootkey + $b + "\microsoft\windows\currentversion\uninstall",$c)
      if right($k,17)="000-0000000FF1CE}"
        $s=split($k,"-")[1]
        if -1<ascan($e,$s)
          $OfficeVersion=split(readvalue($rootkey+$b+"\microsoft\windows\currentversion\uninstall\"+$k,"DisplayVersion"),".")[0]
          $OfficePath=readvalue($rootkey+$b+"\microsoft\windows\currentversion\uninstall\"+$k,"InstallLocation") + "Office" + $OfficeVersion
        endif
      endif
      $c=$c+1
    until $k="" or $officePath<>""
  next
  $regview=setoption("wow64alternateregview",$regview)
endfunction
 |  
| Top |  |  |  |  
| 
| 
| #210663 - 2015-09-01 03:47 PM  Re: Get Office Details
[Re:  Lonkero] |  
| Allen   KiX Supporter
 
       
 Registered:  2003-04-19
 Posts: 4562
 Loc:  USA
 |  |  
| Top |  |  |  |  
 Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
 
 | 
| 
 
| 0 registered
and 739 anonymous users online. 
 | 
 |  |