How to find all LinkedMailboxes and convert them to UserMailboxes.
In this post I will look at how to find all LinkedMailboxes in the Exchange environment and then converting them to UserMailboxes.
What is a LinkedMailbox?
A linked mailbox is a mailbox associated with an external account. The resource forest scenario is an example of when you would want to associate a mailbox with an external account. In a resource forest scenario, user objects in the Exchange forest have mailboxes, but the user objects are disabled for logon. You must associate these disabled user accounts in the Exchange forest with enabled user objects in the external accounts forest.
To get started lets run the following cmdlet to find all the LinkedMailboxes.
1 |
Get-Mailbox -ResultSize Unlimited |Where-Object {$_.RecipientTypeDetails -eq "LinkedMailbox"} |Select Name, RecipientTypeDetails |
Now the next step would be to convert this LinkedMailbox to a normal UserMailbox type. To complete this step we need run the following cmdlet to make the change to the mailbox.
1 |
Set-User <UserA> -LinkedMasterAccount $null |
To verify that the LinkedMailbox type has been removed, run the following cmdlet to verify the RecipientTypeDetails of the Mailbox.
1 |
Get-Mailbox <UserA> |Select Name,RecipientTypeDetails |
The following cmdlet can be run to remove the LinkedMailbox State from all Mailboxes.
1 |
Get-Mailbox -ResultSize Unlimited |Where-Object {$_.RecipientTypeDetails -eq "LinkedMailbox"} |Set-Mailbox -LinkedMasterAccount $null |
#ThatLazyAdmin
When I run the below command:
Get-Mailbox -ResultSize Unlimited |Where-Object {$_.RecipientTypeDetails -eq “LinkedMailbox”} |Set-Mailbox -LinkedMasterAccount $null
Return the following error:
Cannot validate argument on parameter ‘LinkedMasterAccount’. The argument is null. Provide a valid value for the
argument, and then try running the command again.
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Set-Mailbox
+ PSComputerName : ogcexhmbx01.oman-gas.com.om
I have replaced the cmd with the following:
Get-Mailbox -ResultSize Unlimited |Where-Object {$_.RecipientTypeDetails -eq “LinkedMailbox”} |Set-User -LinkedMasterAccount $null
The command executed successfully