Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Disable all Outlook add-ins except for a specified list
# List of add-in names that ARE permitted. Everything else will be disabled
$permittedAddIns = "Redemption.Addin","WorkSiteEmailManagement.Connect","imFileSite.Connect"
# Registry paths to search
$registryPaths = "Registry::HKEY_USERS\S-1-5-21-*\Software\Microsoft\Office\Outlook\Addins",
# Build up a list of add-ins by searching the specified paths
$addIns += ($registryPaths | ForEach-Object {Get-Item $_ | Get-ChildItem | Where-Object -Filter {($_.GetValue("LoadBehavior") -and $_.GetValue("LoadBehavior") -ne 0)}})
# Narrow down our list of add-ins to only those that don't match our permitted list
$deniedAddIns = $addIns | ? {$_.PSChildName -notin $permittedAddIns}
# Loop through all of the denied add-ins, and set the LoadBehavior
foreach ($addin in $deniedAddIns) {
# If the current add-in's LB is already set to 0. Skip this one.
if ($addin.GetValue("LoadBehavior") -eq 0) { continue }
# Set the LoadBehavior to zero
Set-ItemProperty -Path "Registry::$($addin.Name)" -Name "LoadBehavior" -Value 0 -WhatIf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment