Shared mailboxes by powershell

HASSAN BIN NASIR DAR 391 Reputation points
2022-11-23T01:20:46.2+00:00

Hi

I have few questions regarding shared mailboxes.

1- I have a shared mailboxes account list with csv. How can I imoprt csv in exchange online?

2- How can I get the list of shared mailboxes with permissions members in exchange online? Any powershell cmdlets?

Regards

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Amit Singh 5,306 Reputation points
    2022-11-23T06:17:02.44+00:00

    Solution for Que 1: You can use Exchange Online PowerShell and a CSV (comma-separated value) file to bulk import external contacts into Exchange Online. It's a three-step process:
    Step 1: Create a CSV file that contains information about the external contacts
    Step 2: Create the external contacts with PowerShell
    Step 3: Add information to the properties of the external contacts

    Check detail step here - https://learn.microsoft.com/en-us/microsoft-365/compliance/bulk-import-external-contacts?view=o365-worldwide

    Solution for Que 2:

    1. Connect to Office 365 PowerShell, run the PowerShell ISE as Administrator and execute the following command: Set-ExecutionPolicy RemoteSigned
      $Cred = Get-Credential
    2. Type your user ID and password in the Windows PowerShell Credential Request and click OK.
    3. Create a session using the following command, modifying –ConnectionUri parameter based on your Exchange Online location: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic –AllowRedirection
    4. Connect to Exchange Online: Import-PSSession $Session –DisableNameChecking
    5. Copy and run the following script, adjusting the filters for the specific user you want to report on and specifying the desired path for the CSV file output: Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Get-MailboxPermission |Select-Object Identity,User,AccessRights | Where-Object {($_.user -like '@')}|Export-Csv C:\Temp\sharedfolders.csv -NoTypeInformation
    6. Review the resulting CSV report:
    7. Terminate your session with following cmdlet: Remove-PSSession$Session
    0 comments No comments

  2. Jame Xu-MSFT 4,191 Reputation points
    2022-11-23T09:38:27.073+00:00

    Hi @HASSAN BIN NASIR DAR ,
    In the first question, does the shared mailbox list mean creating a new shared mailbox list or modifying the content in the shared mailbox? You could refer to CSV files for Mailbox migration in Exchange Online.
    For the second question, you could use the cmdlet:

    Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox | Get-MailboxPermission | Select-Object Identity,User,AccessRights  
    

    You could refer to: Get a list of shared mailboxes and members using Powershell
    Microsoft provides third-party contact information to help you find additional information about this topic. This contact information may change without notice. Microsoft does not guarantee the accuracy of third-party contact information.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. HASSAN BIN NASIR DAR 391 Reputation points
    2022-11-29T00:47:13.483+00:00

    Hi

    Thanks for your reply.

    I have understood for question 2. But still I am confuse for question 1.

    Actually I have exported csv file from exchange online. Now I want to import this file to another tenant (Exchange online).

    I want to do 2 steps.

    In 1st step, I just want to import csv file to another tenant without permission members.

    2nd steps, After some days I want to add same permission members in relevant shared mailboxes.

    Regards


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.