Does anyone know what would be the best way to detect which version of Office is installed? Plus, if there are multiple versions of Office installed, I’d like to know what versions they are. A bonus would be if I can detect the specific version(s) of Excel that is(/are) installed.
One way to check for the installed Office version would be to check the InstallRoot registry keys for the Office applications of interest.
For example, if you would like to check whether Word 2007 is installed you should check for the presence of the following Registry key:
HKLM\Software\Microsoft\Office\12.0\Word\InstallRoot::Path
This entry contains the path to the executable.
Replace 12.0 (for Office 2007) with the corresponding version number:
Office 97 - 7.0
Office 98 - 8.0
Office 2000 - 9.0
Office XP - 10.0
Office 2003 - 11.0
Office 2007 - 12.0
Office 2010 - 14.0 (sic!)
Office 2013 - 15.0
Office 2016 - 16.0
Office 2019 - 16.0 (sic!)
The other applications have similar keys:
HKLM\Software\Microsoft\Office\12.0\Excel\InstallRoot::Path
HKLM\Software\Microsoft\Office\12.0\PowerPoint\InstallRoot::Path
Or you can check the common root path of all applications:
HKLM\Software\Microsoft\Office\12.0\Common\InstallRoot::Path
Another option, without using specific Registry keys would be to query the MSI database using the MSIEnumProducts API as described here.
As an aside, parallel installations of different Office versions are not officially supported by Microsoft. They do somewhat work, but you might get undesired effects and inconsistencies.
Update: Office 2019 and Office 365
As of Office 2019, MSI-based setup are no longer available, Click-To-Run is the only way to deploy Office now. Together with this change towards the regularly updated Office 365, also the major/minor version numbers of Office are no longer updated (at least for the time being). That means that – even for Office 2019 – the value used in Registry keys and the value returned by Application.Version (e.g. in Word) still is 16.0.
For the time being, there is no documented way to distinguish the Office 2016 from Office 2019. A clue might be the file version of the winword.exe; however, this version is also incremented for patched Office 2016 versions (see the comment by @antonio below).
If you need to distinguish somehow between Office versions, e.g. to make sure that a certain feature is present or that a minimum version of Office is installed, probably the best way it to look at the file version of one of the main Office applications:
// Using the file path to winword.exe
// Retrieve the path e.g. from the InstallRoot Registry key
var fileVersionInfo = FileVersionInfo.GetVersionInfo(@"C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE");
var version = new Version(fileVersionInfo.FileVersion);
// On a running instance using the `Process` class
var process = Process.GetProcessesByName("winword").First();
string fileVersionInfo = process.MainModule.FileVersionInfo.FileVersion;
var version = Version(fileVersionInfo);
The file version of Office 2019 is 16.0.10730.20102, so if you see anything greater than that you are dealing with Office 2019 or a current Office 365 version.
Bonjour,
Détecter la version exacte de Microsoft Office installée sur un système Windows est une tâche courante pour les administrateurs système, les équipes de support et les développeurs qui doivent adapter leur comportement en fonction de la version présente. Il existe de nombreuses méthodes, du plus simple au plus avancé. Voici un guide exhaustif.
Méthode 1 : Depuis l’interface utilisateur Office (méthode visuelle)
Office 2019, 2021, Microsoft 365 (Abonnement)
- Ouvrez une application Office (Word, Excel, etc.)
- Cliquez sur Fichier dans le ruban
- Sélectionnez Compte (ou Aide selon la version)
- La version s’affiche sous Informations sur le produit
- Cliquez sur À propos de Word/Excel pour voir le numéro de build complet
Office 2016 et versions antérieures
- Ouvrez Word ou Excel
- Cliquez sur Fichier > Aide
- La version complète apparaît sous À propos de Microsoft Word
Méthode 2 : Via PowerShell (méthode recommandée pour les administrateurs)
Détection via le registre Windows
Le registre Windows contient toutes les informations de version d’Office. Voici un script PowerShell complet :
# Script complet de détection de la version Microsoft Office
function Get-OfficeVersion {
$officeVersions = @{
"16.0" = "Office 2016 / 2019 / 2021 / Microsoft 365"
"15.0" = "Office 2013"
"14.0" = "Office 2010"
"12.0" = "Office 2007"
"11.0" = "Office 2003"
"10.0" = "Office XP (2002)"
"9.0" = "Office 2000"
}
$registryPaths = @(
"HKLM:\SOFTWARE\Microsoft\Office",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office"
)
foreach ($path in $registryPaths) {
if (Test-Path $path) {
$versions = Get-ChildItem $path -ErrorAction SilentlyContinue |
Where-Object { $_.PSChildName -match "^\d+\.\d+$" }
foreach ($ver in $versions) {
$majorVersion = $ver.PSChildName
$productName = $officeVersions[$majorVersion]
if (-not $productName) { $productName = "Version inconnue" }
# Chercher le numéro de build précis
$wordPath = Join-Path $ver.PSPath "Word\InstallRoot"
$excelPath = Join-Path $ver.PSPath "Excel\InstallRoot"
$installPath = $null
if (Test-Path $wordPath) {
$installPath = (Get-ItemProperty $wordPath -ErrorAction SilentlyContinue).Path
} elseif (Test-Path $excelPath) {
$installPath = (Get-ItemProperty $excelPath -ErrorAction SilentlyContinue).Path
}
Write-Host "Version détectée : $majorVersion ($productName)" -ForegroundColor Cyan
if ($installPath) {
Write-Host "Chemin d'installation : $installPath" -ForegroundColor Gray
}
}
}
}
}
Get-OfficeVersion
Détection via les exécutables Office
# Méthode alternative : lire la version depuis les binaires Office
$officePaths = @(
"${env:ProgramFiles}\Microsoft Office\root\Office16\WINWORD.EXE",
"${env:ProgramFiles}\Microsoft Office\Office16\WINWORD.EXE",
"${env:ProgramFiles(x86)}\Microsoft Office\root\Office16\WINWORD.EXE",
"${env:ProgramFiles(x86)}\Microsoft Office\Office16\WINWORD.EXE",
"${env:ProgramFiles}\Microsoft Office\Office15\WINWORD.EXE",
"${env:ProgramFiles(x86)}\Microsoft Office\Office15\WINWORD.EXE"
)
foreach ($path in $officePaths) {
if (Test-Path $path) {
$fileVersion = (Get-Item $path).VersionInfo
Write-Host "Fichier : $path" -ForegroundColor Cyan
Write-Host "Version fichier : $($fileVersion.FileVersion)" -ForegroundColor Green
Write-Host "Version produit : $($fileVersion.ProductVersion)" -ForegroundColor Green
Write-Host "Nom du produit : $($fileVersion.ProductName)" -ForegroundColor Green
break
}
}
Script universel de détection avancée
# Script complet pour obtenir toutes les informations Office installées
$officeInfo = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*,
HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* `
-ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -like "*Microsoft Office*" -or $_.DisplayName -like "*Microsoft 365*" } |
Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, InstallLocation |
Sort-Object DisplayName -Unique
$officeInfo | Format-Table -AutoSize
# Version numérique -> nom marketing
$versionMap = @{
"16.0" = "Office 2016/2019/2021/M365"
"15.0" = "Office 2013"
"14.0" = "Office 2010"
"12.0" = "Office 2007"
}
foreach ($item in $officeInfo) {
if ($item.DisplayVersion) {
$major = ($item.DisplayVersion -split "\.")[0..1] -join "."
$name = $versionMap[$major]
if ($name) {
Write-Host "$($item.DisplayName) -> $name (Build: $($item.DisplayVersion))" -ForegroundColor Yellow
}
}
}
Méthode 3 : Via la ligne de commande (CMD)
:: Détecter Office via le registre en CMD
reg query "HKLM\SOFTWARE\Microsoft\Office" /f "ClickToRun" /s 2>nul
reg query "HKLM\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot" 2>nul
reg query "HKLM\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Common\InstallRoot" 2>nul
:: Vérifier la version via WMIC
wmic product where "name like 'Microsoft Office%%'" get Name, Version
:: Alternative plus rapide
wmic product where "name like 'Microsoft 365%%'" get Name, Version
Méthode 4 : Distinguer Office Click-to-Run vs MSI
Depuis Office 2013, Microsoft propose deux modes d’installation : Click-to-Run (C2R) et MSI (Windows Installer traditionnel). Les identifier est important car ils se gèrent différemment.
# Détecter le type d'installation
$c2rPath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun"
$c2rPath32 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun"
if (Test-Path $c2rPath) {
$c2rProps = Get-ItemProperty $c2rPath -ErrorAction SilentlyContinue
Write-Host "Type : Click-to-Run (C2R)" -ForegroundColor Cyan
Write-Host "Version : $($c2rProps.PackageVersion)" -ForegroundColor Green
Write-Host "Canal de mise à jour : $($c2rProps.CDNBaseUrl)" -ForegroundColor Green
} elseif (Test-Path $c2rPath32) {
$c2rProps = Get-ItemProperty $c2rPath32 -ErrorAction SilentlyContinue
Write-Host "Type : Click-to-Run (C2R) 32 bits" -ForegroundColor Cyan
Write-Host "Version : $($c2rProps.PackageVersion)" -ForegroundColor Green
} else {
Write-Host "Type : Installation MSI traditionnelle" -ForegroundColor Yellow
}
Méthode 5 : Via WMI (pour les scripts d’inventaire en entreprise)
# Méthode WMI/CIM - idéale pour les requêtes à distance
$officeProducts = Get-CimInstance -ClassName Win32_Product |
Where-Object { $_.Name -like "*Microsoft Office*" -or $_.Name -like "*Microsoft 365*" } |
Select-Object Name, Version, Vendor, InstallDate, InstallLocation
$officeProducts | Format-Table -AutoSize
# Requête sur un ordinateur distant
$remoteComputer = "NOM_ORDINATEUR_DISTANT"
$remoteOffice = Get-CimInstance -ClassName Win32_Product -ComputerName $remoteComputer |
Where-Object { $_.Name -like "*Microsoft Office*" }
$remoteOffice | Select-Object Name, Version | Format-Table
Correspondance des numéros de version Office
| Version marketing | Numéro de version | Build exemple |
|---|---|---|
| Microsoft 365 (continu) | 16.0.x | 16.0.17726.20160 |
| Office 2021 | 16.0.x | 16.0.14332.x |
| Office 2019 | 16.0.x | 16.0.10396.x |
| Office 2016 | 16.0.x | 16.0.4266.x à 16.0.5422.x |
| Office 2013 | 15.0.x | 15.0.4420.x |
| Office 2010 | 14.0.x | 14.0.4760.x |
| Office 2007 | 12.0.x | 12.0.4518.x |
Note importante : Office 2016, 2019, 2021 et Microsoft 365 partagent tous la version principale 16.0. Pour les distinguer, il faut examiner le numéro de build complet ou la présence de la clé de registre C2R.
Méthode 6 : Déploiement à grande échelle avec le Script de diagnostic Office (SaRA)
Pour les environnements d’entreprise, Microsoft met à disposition le Support and Recovery Assistant (SaRA) ainsi que des scripts de diagnostic :
# Utiliser l'outil ODT pour inventorier Office en entreprise
# Télécharger l'outil de déploiement Office (ODT) depuis Microsoft
# Créer un rapport d'inventaire Office pour tout le parc
$computers = Get-ADComputer -Filter * -Properties Name | Select-Object -ExpandProperty Name
$results = foreach ($computer in $computers) {
if (Test-Connection -ComputerName $computer -Count 1 -Quiet) {
$office = Get-CimInstance -ClassName Win32_Product -ComputerName $computer -ErrorAction SilentlyContinue |
Where-Object { $_.Name -like "*Microsoft Office*" } |
Select-Object -First 1
[PSCustomObject]@{
ComputerName = $computer
OfficeProduct = $office.Name
Version = $office.Version
Status = "Accessible"
}
} else {
[PSCustomObject]@{
ComputerName = $computer
OfficeProduct = "N/A"
Version = "N/A"
Status = "Inaccessible"
}
}
}
$results | Export-Csv "C:\inventaire_office.csv" -NoTypeInformation -Encoding UTF8
Write-Host "Rapport exporté dans C:\inventaire_office.csv" -ForegroundColor Green
Résumé des méthodes selon le cas d’usage
| Cas d’usage | Méthode recommandée | Complexité |
|---|---|---|
| Vérification rapide sur un poste | Interface Office (Fichier > Compte) | Très facile |
| Script de détection local | PowerShell + registre | Facile |
| Inventaire de parc | PowerShell + WMI/CIM distant | Intermédiaire |
| Différencier C2R vs MSI | PowerShell registre ClickToRun | Intermédiaire |
| Déploiement/scripts automatisés | WMI + numéros de build | Avancé |
Conclusion
La méthode la plus fiable et la plus complète pour détecter la version d’Office est l’interrogation du registre Windows via PowerShell, combinée à la lecture du numéro de build des exécutables. Pour un usage en entreprise sur plusieurs postes, le script WMI avec export CSV permet de constituer un inventaire complet de votre parc Office rapidement.
N’hésitez pas à préciser votre contexte (un seul poste, déploiement en entreprise, scripting automatisé, besoin de distinguer entre Office 2019 et M365) pour que je vous fournisse un script encore plus adapté à votre situation.