Created
July 7, 2015 02:51
-
-
Save dstreefkerk/225c81f3a9bf4ddc06aa to your computer and use it in GitHub Desktop.
Disable all Outlook add-ins except for a specified list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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", | |
"Registry::HKEY_USERS\S-1-5-21-*\Software\Wow6432Node\Microsoft\Office\Outlook\Addins", | |
"HKLM:\Software\Wow6432Node\Microsoft\Office\Outlook\Addins", | |
"HKLM:\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