locked
Disable automapping for specific users RRS feed

  • Question

  • Hello All,

    I have a DL which contains the users list and i have to remove automapping feature for them.

    we have more than 3 sharedmailbox and 50+ users per sharedmailbox to disable this feature so i can't do it manually.

    Can someone please help me with the powershell script which gets input from text file which contains username? Thanks in Advance

    Regards,

    Mac


     

    Sunday, May 11, 2014 1:55 PM

Answers

  • Hi,

    If the full access permission has been assigned to 50+ users in the distribution list and you just want to remove auto-mapping on an existing shared mailbox and remove the auto-mapping behavior for users who have already been granted Full Access permissions. We can try the following command:

    $FixAutoMapping = Get-Content c:\users.txt

    $FixAutoMapping | ForEach {Remove-MailboxPermission -Identity SharedMailbox1 -User $_.User -AccessRights FullAccess}

    $FixAutoMapping | ForEach {Add-MailboxPermission -Identity SharedMailbox1 -User $_.User -AccessRights:FullAccess -AutoMapping $false}

    Hope it works.

    Thanks,


    Winnie Liang
    TechNet Community Support

    • Marked as answer by Macman_M Monday, May 12, 2014 10:02 AM
    Monday, May 12, 2014 9:53 AM
    Moderator

All replies

  • Just quickly constructed this for your, haven't try this so make sure you try this on a test shared mailbox by granting access to a test user before running for all 3 shared mailboxes...

    $users = Get-Content c:\users.txt
    foreach ($user in $users)
    {

    $userfind = "*" + $user

    Get-MailboxPermission YourSharedMailboxNameHere | where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false -and $_.user -like "$userfind" } | Remove-MailboxPermission -Confirm:$false

    Add-MailboxPermission YourSharedMailboxNameHere -User $user -AccessRights:FullAccess -AutoMapping $false

    }

    Sunday, May 11, 2014 5:31 PM
  • Or you can open the shared mailboxes via ADSIEdit and go to msExchDelegateListLink attribute and remove the users that you don't want automapping for.

    Sunday, May 11, 2014 5:36 PM
  • Thanks Amit. Sorry i missed one information. I have exchange 2010 sp2. When i ran the below script i got this error.

    User or group "Userlogonname
                   " wasn't found. Please make sure you've typed it correctly.
        + CategoryInfo          : InvalidData: (:) [Add-MailboxPermission], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : FAC24C45,Microsoft.Exchange.Management.RecipientTasks.AddMailboxPermission

    Script:

    $users = Get-Content c:\users.txt
    foreach ($user in $users)
    {

    $userfind = "*" + $user

    Add-MailboxPermission YourSharedMailboxNameHere -User $user -AccessRights:FullAccess -AutoMapping $false

    }

    I believe above one line is enough if i have SP2 so i removed Get-Mailbox line from your script. Please help me 

    Monday, May 12, 2014 2:00 AM
  • If I understood correctly all 50 users are having mailbox access currently but you just want to remove the automapping for them. 

    In fact to remove automapping you first need to remove the access and add the full access back with -automapping $false so actually my line "Get-MailboxPermission YourSharedMailboxNameHere | where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false -and $_.user -like "$userfind" } | Remove-MailboxPermission -Confirm:$false" is removing the mailbox access first and then adding back.

    Error "User or group "Userlogonname " wasn't found." says its not taking the correct shared mailbox name, can you just try running Get-MailboxPermission SharedMailboxName and see if it is giving result, if that works then entire line should work...

    More info about disabling automapping....

    Disable Outlook Auto-Mapping with Full Access Mailboxes

    Monday, May 12, 2014 2:09 AM
  • Thanks Amit. Now i ran the whole script and getting the same error.

    User or group "Userlogonname
                   " wasn't found. Please make sure you've typed it correctly.
        + CategoryInfo          : InvalidData: (:) [Add-MailboxPermission], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : FAC24C45,Microsoft.Exchange.Management.RecipientTasks.AddMailboxPermission

    I'm very sure my sharedmailbox name is correct and as well the logon name in text file because when i ran the below script manually it get successful.

     Add-MailboxPermission "India Mail" -User macman -AccessRights:FullAccess -AutoMapping $false


    Monday, May 12, 2014 2:25 AM
  • Hi,

    If the full access permission has been assigned to 50+ users in the distribution list and you just want to remove auto-mapping on an existing shared mailbox and remove the auto-mapping behavior for users who have already been granted Full Access permissions. We can try the following command:

    $FixAutoMapping = Get-Content c:\users.txt

    $FixAutoMapping | ForEach {Remove-MailboxPermission -Identity SharedMailbox1 -User $_.User -AccessRights FullAccess}

    $FixAutoMapping | ForEach {Add-MailboxPermission -Identity SharedMailbox1 -User $_.User -AccessRights:FullAccess -AutoMapping $false}

    Hope it works.

    Thanks,


    Winnie Liang
    TechNet Community Support

    • Marked as answer by Macman_M Monday, May 12, 2014 10:02 AM
    Monday, May 12, 2014 9:53 AM
    Moderator