none
Remove user from shared mailboxes where he is listed as full owner and re-add back permissions with auto-mount feature disabled RRS feed

  • Question

  • Hi MS team

    I need your help to build a PowerShell Script to resolve a production issue. Basically, there are 10 users that had been granted with full access over 50 shared and resource mailboxes, and every time they launch outlook, all the 50 mailboxes are automatically mounted because the auto mapping feature.

    the script should perform following:

    Given a user name or email alias as input, the script should return or display all shared/resource mailbox where that user is granted with full access and auto mapping is true. I mean it should list all these shared mailboxes where the user is owner  and export to a CSV file. Once the information above is exported, we need to remove the account from all shared/resource mailboxes where it was granted access to and then  add it back with auto-mapped = off settings.

    yes, just to clarify my request:

    John Doe has auto-mounted more than 100 mailboxes on his outlook profile, because in the past full owner rights were assigned to those shared and resource mailboxes with the auto-mounting feature enabled by default. My request is to populate those shared mailboxes in a csv file, then remove then, and add it back to his profile with the auto-mounting option disabled or false



    • Edited by Jason Patrick Tuesday, January 22, 2019 7:48 PM
    • Moved by Bill_Stewart Friday, March 15, 2019 6:19 PM This is not "scripts on demand"
    Tuesday, January 22, 2019 7:46 PM

All replies

  • I tried following code, but is not returning any values

    $res = Get-Mailbox -RecipientTypeDetails RoomMailbox,SharedMailbox -ResultSize Unlimited | Get-MailboxPermission -User JohnDoe
    $res = |% {Remove-MailboxPermission $_.Identity -User $_.User -AccessRights FullAccess }
    $res = |% {Add-MailboxPermission $_.Identity -User $_.User -AccessRights FullAccess -AutoMapping $false}



    Tuesday, January 22, 2019 7:48 PM
  • That is correct.  All returned data is being stored in a variable so you will never see anything.

    $_.User is not defined anywhere.

    Start by carefully reading all of the help for each  command and then try to write your script based on an understanding of how the commands work.

    All of your commands make absolutely no sense.  Learning how they are intended to be used and learning PowerShell syntax will get you a step farther.


    \_(ツ)_/

    Tuesday, January 22, 2019 10:10 PM