Disable Auto Mapping of Exchange Mailboxes

Hi Readers,

Exchange 2010/2013 has a feature called automapping of mailboxes. It gets invoked when you provide full access to the mailbox, This feature causes issues at least what we have seen in few environments.

So We want to turn this feature off but there is no straight way to Globally turn it off.We have asked our L2 Exchange admins to provide access via Shell & use automapping $false

ADD-MailboxPermission -Identity “MailboxName” -User “UserName” -AccessRights FullAccess -AutoMapping $false

We can’t control everyone so we have written below script that uses Exchange Management Shell & Quest AD Shell to turn off this Globally, This script can be scheduled to run daily.

Exchange Uses “msExchDelegateListLink” attribute for Automapping.

This Script uses this attribute for reporting & set it to Null for removing Automap.

Capture

It also logs the mailboxes for which “msExchDelegateListLink” has been set to Null

Capture

Script can be Downloaded from Below Link:

https://gallery.technet.microsoft.com/scriptcenter/Disable-Auto-Mapping-of-13f92205

Extract the Zip file & run the Batch–> you are done.

Prerequisites:

  • Exchange Management Shell
  • Quest AD Shell
############################################################################# 
#       Author: Vikas Sukhija 
#       Reviewer:     
#       Date: 01/24/2015 
#       Satus:  
#       Update: 04/12/2015 
#       Description: Report & turn of auto mapping status 
############################################################################# 
####################Define logs############################################## 
 
$limit = (Get-Date).AddDays(-60) #for log recycling 
$date = get-date -format d 
$date = $date.ToString().Replace(“/”, “-”) 
$time = get-date -format t 
 
$time = $time.ToString().Replace(":""-"$time = $time.ToString().Replace(" """) 
 
$path = ".\logs\" 
$output1 = ".\logs\" + "AutomappingR_" + $date + "_" + $time + "_.csv" 
$output2 = ".\logs\" + "Automapping_" + $date + "_" + $time + "_.log" 
 
###########################Add Shells######################################## 
If ((Get-PSSnapin | where {$_.Name -match "Microsoft.Exchange.Management.PowerShell.E2010"}) -eq $null) 
{ 
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 
} 
 
If ((Get-PSSnapin | where {$_.Name -match "Quest.ActiveRoles.ADManagement"}) -eq $null) 
{ 
    Add-PSSnapin Quest.ActiveRoles.ADManagement 
} 
 
$Collection = @() 
 
$allmailboxes = get-mailbox -resultsize unlimited 
 
$allmailboxes | foreach-object{ 
 
$user =  $_.SamAccountName 
$user 
$automap = get-qaduser  $user -includedproperties "msExchDelegateListLink" | where{$_.msExchDelegateListLink} | select Name,@{Name = "msExchDelegateListLink";Expression ={$_.msExchDelegateListLink}} 
$automap 
 
if($automap.msExchDelegateListLink){ 
 
$coll = "" | select Name,Automap 
 
$coll.Name = $automap.Name 
$coll.Automap = $automap.msExchDelegateListLink 
 
$collection +$coll 
} 
 
} 
 
$collection | export-csv $output1 -notypeinformation 
 
timeout 10 
 
###########################Set Automapping to Null########################## 
 
$collection | foreach$aname = $_.Name 
write-host "processing..... $aname" -foregroundcolor green 
 
$user = get-qaduser $aname -includedproperties "msExchDelegateListLink" 
$name = $user.Name 
 
$automapnull = $user | Set-QADUser -ObjectAttributes @{msExchDelegateListLink = $null} 
 
add-content $output2 "$name .........msExchDelegateListLink...attribute has been set to ...Null" 
} 
 
########################Recycle logs ###################################### 
 
Get-ChildItem -Path $path  | Where-Object {   
$_.CreationTime -lt $limit } | Remove-Item -recurse -Force  
 
########################################################################### 

Tech Wizard

https://techwizard.cloud

https://syscloudpro.com/

 

Advertisement

One thought on “Disable Auto Mapping of Exchange Mailboxes

  1. Pingback: Exchange Online and Automapping | Microsoft Technologies Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s