Get Office add-ins/plugins from infrastructure using Intune and PowerShell

In a previous article, we had a look on how to get your office add-ins from the infrastructure by using SCCM and PowerShell. As mentioned, there are multiple ways in which you can achieve this so don’t take this article as the only way.


PowerShell Script

With this in mind, as we did with SCCM, we must first create a PowerShell script which gets all the Office Add-ins and writes them in a CSV. The CSV is stored on a network share that is accessible to everybody. The script checks all Office registry keys to gather the add-ins, and also has a check to see if the CSV is currently in use by another user (because multiple users will write at the same time in this file). The code for the script is:

function Check-FileOpen {

param (




$oFile = New-Object System.IO.FileInfo $Path

if ((Test-Path -Path $Path) -eq $false)







$oStream = $oFile.Open([System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None)

if ($oStream)








# file is locked by a process.




$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


Don’t forget to modify the location where the script is saved and where the script checks if it’s opened/in use or not. Now that the script is ready, all we need to do is deploy it via Intune.


Create and Deploy Script in Intune

In Intune, you have multiple choices to deploy a script, for example create an .intunewin file and push it, or we can use the native Scripts deployment method from Intune. First, navigate to the start page of Intune.

Next, navigate to Devices > Scripts:

Click on Add > Windows 10:

Give it a Name and a Description:

Next, select the script from your local machine. In our case, we wanted the script to run in the user context, because we are searching through user registry keys, so we checked Yes for “Run this script using the logged on credentials”. We also want the script to run in 64-bit environment, so we selected Yes for “Run script in 64 bit PowerShell Host”:

The last step is to select the groups you want the script to be deployed, or the groups you want to exclude from the deployment:

Review and add your script/deployment:

At the end, after the script is executed on the users machine, you should have a CSV populated with all the necessary information:

Leave a comment

Your email address will not be published. Required fields are marked *

10 + 14 =