Jump to content

Check which Version of Office is installed


bbulldog
 Share

Recommended Posts

here is a script to read out the Office Version installed. Also shows which version of the .exe files are installed.

#include <File.au3>

Local $objFSO = ObjCreate("Scripting.FileSystemObject")
Local $WSHShell = ObjCreate("WScript.Shell")

$textout = ""

Dim $part[2][5] = [["Word","Excel","Outlook","PowerPoint","Access"],["WINWORD.EXE","EXCEL.EXE","OUTLOOK.EXE","POWERPNT.EXE","MSACCESS.EXE"]]

$textout = "Installierte Office-Anwendungen:" & @CRLF & @CRLF

ChkOffice("14.0","2013")
ChkOffice("13.0","2010")
ChkOffice("12.0","2007")
ChkOffice("11.0","2003")
ChkOffice("10.0","XP")
ChkOffice("9.0", "2000")
ChkOffice("8.0", "97")
MsgBox(4096, " " , $textout , 10)

func ChkOffice($ver, $verfull)

$pfad = "HKLM\Software\Microsoft\Office\" & $ver & "\Common\InstallRoot"

$res = RegRead($pfad,"path" )

 If $res <> "" Then
  $textout = $textout & "Office " & $verfull & " installiert" & @CRLF & @CRLF

  For $i = 0 to 4

   If FileExists($res & $part[1][$i]) Then
    $helptext = $part[1][$i] & " " & $verfull & " " & FileGetVersion($res & $part[1][$i])
    $textout = $textout & $helptext & @CRLF

   EndIf


  Next

 EndIf
EndFunc
Edited by bbulldog
Link to comment
Share on other sites

:)

MsgBox(0, ' Retrieve Windows Product Info ', _GetWindowskey())

Func _GetWindowskey()
    Local $WindowsRegkey = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
    local $WindowscdKEy = "Product Name : " & RegRead($WindowsRegkey, 'ProductName') & @CRLF
    $WindowscdKEy &= "Product Id : " & RegRead($WindowsRegkey, 'ProductId') & @CRLF
    $WindowscdKEy &= "Install Key : " & _Converted(RegRead($WindowsRegkey, 'DigitalProductId')) & @CRLF
    Local $OfficeCdkey, $ZOFkey, $Getnumkey
    Dim $OfficeVer[5] = ["10.0", "11.0", "12.0", "14.0", "15.0"]
    For $i = 0 To 4
        $ZOFkey = 'HKLM\SOFTWARE\Microsoft\Office\' & $OfficeVer[$i] & '\Registration\'
        $Getnumkey = _Getnumkey($ZOFkey)
        If $Getnumkey[0] <> "" Then
            For $Ii = 1 To $Getnumkey[0]
                $OfficeCdkey &= "Product Name : " & RegRead($ZOFkey & $Getnumkey[$Ii], 'ProductName') & @CRLF
                $OfficeCdkey &= "Product Id : " & RegRead($ZOFkey & $Getnumkey[$Ii], 'ProductId') & @CRLF
                $OfficeCdkey &= "Install Key : " & _Converted(RegRead($ZOFkey & $Getnumkey[$Ii], 'DigitalProductId')) & @CRLF & @CRLF
            Next
        EndIf
    Next
    Return '-Windows key : ' & @CRLF & @CRLF & $WindowscdKEy & @CRLF & '-Office Key : ' & @CRLF & @CRLF & $OfficeCdkey
EndFunc   ;==>_GetWindowskey
Func _Converted($id)
    $id = _KEyArry($id)
    Local $Converted, $Cur, $x
    Local $OFFSET = 52
    Local $i = 28
    Local $Chars = "BCDFGHJKMPQRTVWXY2346789"
    Do
        $Cur = 0
        $x = 14
        Do
            $Cur = $Cur * 256
            $Cur = $id[$x + $OFFSET] + $Cur
            $id[$x + $OFFSET] = BitAND(Int(($Cur / 24)), 255)
            $Cur = Mod($Cur, 24)
            $x = $x - 1
        Until $x < 0
        $i = $i - 1
        $Converted = StringMid($Chars, $Cur + 1, 1) & $Converted
        If Mod((29 - $i), 6) = 0 And $i <> -1 Then
            $i = $i - 1
            $Converted = "-" & $Converted
        EndIf
    Until $i < 0
    Return $Converted
EndFunc   ;==>_Converted
Func _KEyArry($BIn)
    Local $Count
    Local $Slen = StringLen($BIn)
    Dim $keyarray[BinaryLen($BIn)]
    For $i = 3 To $Slen Step 2
        $keyarray[$Count] = Dec(StringMid($BIn, $i, 2))
        $Count += 1
    Next
    Return $keyarray
EndFunc   ;==>_KEyArry
Func _Getnumkey($Skey)
    Local $i, $Vkey
    Dim $NumkeyArry[1]
    While True
        $i += 1
        $Vkey = RegEnumKey($Skey, $i)
        If @error Then ExitLoop
        ReDim $NumkeyArry[$i + 1]
        $NumkeyArry[0] = $i
        $NumkeyArry[$i] = $Vkey
    WEnd
    Return $NumkeyArry
EndFunc   ;==>_Getnumkey
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...