locked
Shared mailbox RRS feed

  • Question

  • Hi Experts

    I am using exchange hybrid environment, i have Shared mailboxes in Exchange Onprem and Exchange Online, i want to pull the report of these mailboxes to csv file, Shared mailbox name, when created, who created and last access date. experts help me with powershell syntax

    Tuesday, November 12, 2019 3:47 AM

Answers

  • Hi,

    You can try with the following script:

    Get-mailbox -RecipientTypeDetails sharedmailbox | foreach-object{ $mailbox = $_ $name = $mailbox.name $WhenMailboxCreated = $mailbox.WhenMailboxCreated $LastLogonTime = (Get-Mailboxstatistics $name).LastLogonTime $ID = $mailbox.ID $caller = (Search-AdminAuditLog -Cmdlets new-mailbox -Parameters Shared -IsSuccess $true -StartDate $WhenMailboxCreated |Where-Object {$_.ObjectModified -eq $ID} ).caller New-Object -TypeName PSObject -Property @{              Name=$name              WhenMailboxCreated=$WhenMailboxCreated  LastLogonTime=$LastLogonTime ID=$ID Caller=$caller       } }|Export-csv c:\shared.csv -NoTypeInformation

    Please pay attention that, we have to use Administrator audit logs to check who created the shared mailbox. So we have to make sure the admin audit log is enabled and log entries are stored under the audit log age limit.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Wednesday, November 13, 2019 5:48 AM

All replies

  • Hi,

    You can try with the following script:

    Get-mailbox -RecipientTypeDetails sharedmailbox | foreach-object{ $mailbox = $_ $name = $mailbox.name $WhenMailboxCreated = $mailbox.WhenMailboxCreated $LastLogonTime = (Get-Mailboxstatistics $name).LastLogonTime $ID = $mailbox.ID $caller = (Search-AdminAuditLog -Cmdlets new-mailbox -Parameters Shared -IsSuccess $true -StartDate $WhenMailboxCreated |Where-Object {$_.ObjectModified -eq $ID} ).caller New-Object -TypeName PSObject -Property @{              Name=$name              WhenMailboxCreated=$WhenMailboxCreated  LastLogonTime=$LastLogonTime ID=$ID Caller=$caller       } }|Export-csv c:\shared.csv -NoTypeInformation

    Please pay attention that, we have to use Administrator audit logs to check who created the shared mailbox. So we have to make sure the admin audit log is enabled and log entries are stored under the audit log age limit.

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Wednesday, November 13, 2019 5:48 AM
  • Did you get some information from the script above?

    Please let us know if you would like further assistance. 

    Regards,

    Lydia Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Tuesday, November 19, 2019 2:40 PM