I am trying to do something that is rather custom and I don’t have a lot of time to figure it out.
I have been requested to create a CSV with all the distribution lists in a 365 tenant and its members. The tricky part is the formatting.
The desire is to have the distribution list name in the first line of the first column then all the members listed in the second column going do the line, line 1, 2,3 and so on. When all the members have been listed in the second column, the next distribution list is named in the next line. For instance, the first DL is listed in line 1 of column one. The members are listed in Column 2 lines 1,2,3,4,5 and then the next DL is listed in column 1 line 6 and so on.
Hello there, this forum is for help with specific questions about Powershell. We do not write scripts for people, but instead require some effort by users. If you have code you are working on please post it here with the code format button ‘</>’
the Distribution list name would repeat in column 1 for each member of the distribution list right? If you’re picturing blank spaces there you’ll end up with sorting issues.
Past that @neemobeer is right, most public forums aren’t going to write stuff for you. That’s what places like Fiverr are for.
You’ll probably want to look at Exchange Online module, maybe the Graph API, or maybe just the AD module. It depends on your environment. Then I would typically end up writing PSCustomObjects that contain all the properties I want, and pipe that out to Export-CSV (remember the -NoTypeInformation parameter) and then you can open it in Excel.