Change regular user to shared mailbox

Prosper's picture
Forums: 

Only use this when ADsync was created without a Exchange Hybrid and where Exchange Hybrid is added later on.

 

csv = Import-Csv C:\scripts\sharedmb.csv

 

foreach ($mb in $csv)

    {

    #Write-Host $mb.mailbox

    $upn = $mb.mailbox

    $user =Get-ADUser -Filter {UserPrincipalName -eq $upn}

    $sam = $user.samaccountname

    Write-Host $sam

    Set-ADUser -Identity $sam -Replace @{msExchRemoteRecipientType=100;msExchRecipientTypeDetails=34359738368}

In the csv file only add:

mailbox
email@domain.com

    }