Link to home
Start Free TrialLog in
Avatar of pramod1
pramod1Flag for United States of America

asked on

office 365, exchange, active directory

all mailboxes are in office 365,

we have on premise active directory where user accounts are synced through AAD sync

i need run powershell commnad to get all distribution list and shared mailboxes.

what command i need to run and pipe into csv file?
Avatar of bbao
bbao
Flag of Australia image

Display all Distribution Groups list + details

Get-DistributionGroup


Get a list of Shared mailboxes

Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited


FYI

https://o365info.com/manage-distribution-groups-by-using/

https://blogs.technet.microsoft.com/dpickett/2016/04/29/how-to-get-a-list-of-shared-mailboxes-and-users-with-permissions-to-those-mailboxes-in-exchange-online/
Avatar of pramod1

ASKER

How to pipe into ccsv file
add below redirect command at the end of each command.

> yourfilename.txt

regarding CSV, it depends the content of the text output, you may need to add the field names for CSV file manaully.
here is the  Get-DistributionGroupMembers.ps1 which exports all the distributed members list with group to CSV..

https://gallery.technet.microsoft.com/office/List-all-Users-Distribution-7f2013b2
Just pipe Export-csv like:

 Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Export-csv c:\dg.csv
Avatar of pramod1

ASKER

I am not getting list of shared mailboxes


Can u provide simple command I need to give to user
Avatar of pramod1

ASKER

It says cannot bind parameter delimiter  cannot concert value mailbox .csv to type system .char?
Avatar of pramod1

ASKER

Now I am getting the file but they are containing big numbers not shared mail box name?
can you please post your results here for review? thanks.
ASKER CERTIFIED SOLUTION
Avatar of timgreen7077
timgreen7077

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial