While this is not a new topic, we all know that getting all Office add-ins installed on the machines of an infrastructure is a tricky topic. Microsoft released a new add-in inventory report for Configuration Manager back in 2017, but I didn’t wanted to use a mof file in my SCCM, nor I didn’t want my databse to be altered (it’s already cluttered as it is). If you want to use this method, check out the github page for the script and SCCM report here.
You have an alternative option of using Exchange PowerShell and create a one-Liner that is needed to create a csv-export of all the apps that your users are using, but that method was not what I was searching for either.
The script
I just wanted something easy that I can deploy in the infrastructure and put everything in a CSV on a local share that everybody has access, and then I decided to create a PowerShell script. The code is as follows:
function Check-FileOpen { param ( [parameter(Mandatory=$true)] [string]$Path ) $oFile = New-Object System.IO.FileInfo $Path if ((Test-Path -Path $Path) -eq $false) { $false return } try { $oStream = $oFile.Open([System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None) if ($oStream) { $oStream.Close() } $false } catch { # file is locked by a process. $true } } $searchScopes = "HKLM:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins", "HKLM:\SOFTWARE\Microsoft\Office\Word\Addins","HKCU:\SOFTWARE\Microsoft\Office\Word\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Word\Addins", "HKLM:\SOFTWARE\Microsoft\Office\Excel\Addins","HKCU:\SOFTWARE\Microsoft\Office\Excel\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Excel\Addins", "HKLM:\SOFTWARE\Microsoft\Office\MS Project\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\MS Project\Addins", "HKCU:\SOFTWARE\Microsoft\Office\PowerPoint\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\PowerPoint\Addins" $test = $searchScopes | % {Get-ChildItem -Path $_ | % {Get-ItemProperty -Path $_.PSPath} | Select-Object @{n="Name";e={Split-Path $_.PSPath -leaf}},FriendlyName,Description} | Sort-Object -Unique -Property name foreach ($tst in $test){ $test | Add-Member -Name 'Computer Name' -Type NoteProperty -Value $env:COMPUTERNAME } write-host $test while ((Check-FileOpen -Path "C:\Users\YOURUSER\Desktop\test.csv")){ Start-Sleep -s 15 Write-Host "File in Use" } Write-Host "File Not in Use" $test | export-csv -Path C:\Users\YOURUSER\Desktop\test.csv -NoTypeInformation -Append
Reviewing the script
$searchScopes = "HKLM:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins","HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins", "HKLM:\SOFTWARE\Microsoft\Office\Word\Addins","HKCU:\SOFTWARE\Microsoft\Office\Word\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Word\Addins", "HKLM:\SOFTWARE\Microsoft\Office\Excel\Addins","HKCU:\SOFTWARE\Microsoft\Office\Excel\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\Excel\Addins", "HKLM:\SOFTWARE\Microsoft\Office\MS Project\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\MS Project\Addins", "HKCU:\SOFTWARE\Microsoft\Office\PowerPoint\Addins", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Office\PowerPoint\Addins" $test = $searchScopes | % {Get-ChildItem -Path $_ | % {Get-ItemProperty -Path $_.PSPath} | Select-Object @{n="Name";e={Split-Path $_.PSPath -leaf}},FriendlyName,Description} | Sort-Object -Unique -Property name
HKCU:\SOFTWARE\Microsoft\Office\Word\Addins
foreach ($tst in $test){ $test | Add-Member -Name 'Computer Name' -Type NoteProperty -Value $env:COMPUTERNAME }
while ((Check-FileOpen -Path "C:\Users\YOURUSER\Desktop\test.csv")){ Start-Sleep -s 15 Write-Host "File in Use" } Write-Host "File Not in Use" $test | export-csv -Path C:\Users\YOURUSER\Desktop\test.csv -NoTypeInformation -Append