Manually Disable Skype for Business COM Add-In for Outlook

Manually Disable Skype for Business COM Add-In for Outlook

  •  
  •  
  •  
  •  
  •  
  •  

Today, I was asked about manually disabling the Skype of Business Outlook plug-in for a customer where users have both Skype and Teams clients and are configured in Islands mode.

This is what I came up with.  You can save it and drop it in a computer startup script as well as a user logon (since the script modifies both HKLM and HKCU). If users aren’t administrators on their machines, you may need to split the HKCU piece into a user logon script to ensure they don’t generate errors when trying to modify the registry.

I make attempts to back up the registry into a new value, but as with everything, please test before deploying.  You can test it on your workstation by running interactively with the -Update switch.  If you deploy via GPO / GPP, you can edit the [switch]$Update, line to say [switch]$Update = $true if necessary.

<#
.SYNOPSIS
Disable Skype for Business Plug-In

.PARAMETER CloseOutlook
Force closing of Outlook prior to running.

.PARAMETER Update
Update the value to 0.  Current value is written to -LoadBehavior in appropriate
registry key.

.NOTES
See https://support.microsoft.com/en-us/help/3097122/skype-meeting-control-is-not-displayed-on-outlook-2016 for
more information on Skype plug-in.
#>

[cmdletbinding()]
param (
	[switch]$Update,
	[switch]$CloseOutlook = $true
)

# Unload Skype for Business plug-in from Outlook
try
{
	# Test to see if Outlook is running; if so, close.
	If ($CloseOutlook)
	{
		If (Get-Process -Name Outlook -ea silentlycontinue)
		{
			Stop-Process -Name Outlook -Force; sleep 10
		}
	}
}
catch
{ "Couldn't close Outlook"}

# Click2Run Location 1, 32-bit Office on 32-bit Windows OR 64-bit Office on 64-bit Windows
$c2r1 = (Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -ErrorAction SilentlyContinue).LoadBehavior
If ($c2r1 -ne $null) { Write-Verbose "Current value of C2R1 HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is $($c2r1)."}
If ($c2r1 -eq "0" -and $Update)
{
	$Resultc2r1a = New-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -PropertyType DWORD -Name "-LoadBehavior" -Value $c2r1 | Out-Null
	$Resultc2r1b = Set-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -Name "LoadBehavior" -Value 0
	<#catch
	{
		Write-Verbose "Unable to set value LoadBehavior in HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1"
	}#>
}
if ($c2r1 -eq "0" -and $Update)
{
	Write-Verbose "C2R1 HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is already set to 0."
}
	
# Click2Run Location 2, 32-bit Office on 64-bit Windows
$Error.Clear()
$c2r2 = (Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -ErrorAction SilentlyContinue).LoadBehavior
If ($c2r2 -ne $null) { Write-Verbose "Current value of C2R2 HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is $($c2r2)." }
If ($c2r2 -ne 0 -and $Update)
{
	$Resultc2r2a = New-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -PropertyType DWORD -Name "-LoadBehavior" -Value $c2r2 | Out-Null
	$Resultc2r2b = Set-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -Name "LoadBehavior" -Value 0
	If ($Error) { Write-Verbose $Error.Exception.ToString() }
}

if ($c2r2 -eq "0" -and $Update)
{
	Write-Verbose "C2R2 HKLM:SOFTWARE\Microsoft\Office\ClickToRun\Registry\Machine\Software\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is already set to 0."
}

# MSI Location 1, 32-bit Office on 32-bit Windows OR 64-bit Office on 64-bit Windows
$Error.Clear()
$msi1 = (Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -ErrorAction SilentlyContinue).LoadBehavior
If ($msi1 -ne $null) { Write-Verbose "MSI1 Current value of HKLM:SOFTWARE\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is $($msi1)." }
If ($msi1 -ne $null -and $Update)
{
	$Resultmsi1a = New-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -PropertyType DWORD -Name "-LoadBehavior" -Value $msi1 | Out-Null
	$Resultmsi1b = Set-ItemProperty "HKLM:SOFTWARE\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -Name "LoadBehavior" -Value 0
	If ($Error) { Write-Verbose $Error.Exception.ToString() }
}

if ($msi1 -eq "0" -and $Update)
{
	Write-Verbose "HKLM:SOFTWARE\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is already set to 0."
}

# MSI Location 2, 32-bit Office on 64-bit Windows
$Error.Clear()
$msi2 = (Get-ItemProperty "HKLM:SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -ErrorAction SilentlyContinue).LoadBehavior
If ($msi2 -ne $null) { Write-Verbose "Current value of HKLM:SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is $($msi2)." }
If ($msi2 -ne "0" -and $Update)
{
	$Resultmsi2a = New-ItemProperty "HKLM:SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -PropertyType DWORD -Name "-LoadBehavior" -Value $msi2 | Out-Null
	$Resultmsi2b = Set-ItemProperty "HKLM:SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1" -Name "LoadBehavior" -Value 0
	If ($Error) { Write-Verbose $Error.Exception.ToString() }
}

if ($msi2 -eq "0" -and $Update)
{
	Write-Verbose "MSI2 HKLM:SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\UcAddin.LyncAddin.1\LoadBehavior is already set to 0."
}


# HKCU for Skype Meeting Add-In
$Error.Clear()
$hkcuval = (Get-ItemProperty "HKCU:Software\Microsoft\Office\Outlook\Addins\UCAddin.LyncAddin.1" -ErrorAction SilentlyContinue).LoadBehavior
if ($hkcuval -ne $null)
{
	Write-Verbose "Current value of HKCU:Software\Microsoft\Office\Outlook\Addins\UCAddin.LyncAddin.1\LoadBehavior is $($hkcuval)."
}
if ($hkcuval -ne "0" -and $Update)
{
	$Resulthkcua = New-ItemProperty "HKCU:Software\Microsoft\Office\Outlook\Addins\UCAddin.LyncAddin.1" -PropertyType DWORD -Name "-LoadBehavior" -Value $hkcuval | Out-Null
	$Resulthkcub = Set-ItemProperty "HKCU:Software\Microsoft\Office\Outlook\Addins\UCAddin.LyncAddin.1" -Name "LoadBehavior" -Value 0
	If ($Error) { Write-Verbose $Error.Exception.ToString() }
}

if ($hkcuval -eq "0" -and $Update)
{
	Write-Verbose "HKCU:Software\Microsoft\Office\Outlook\Addins\UCAddin.LyncAddin.1\LoadBehavior is already set to 0."
}

Published by Aaron Guilmette

Helping companies conquer inferior technology since 1997. I spend my time developing and implementing technology solutions so people can spend less time with technology. Specialties: Active Directory and Exchange consulting and deployment, Virtualization, Disaster Recovery, Office 365, datacenter migration/consolidation, cheese.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.