In those cases you’ll want to re-import the CSV file dataĪnd convert the new-line separated membership lists back into PowerShellĪrrays. Script written to manage that exact process). Member names across (in fact, the idea for this script came from a larger You might edit the membership lists and map the source and target group and For example, if you are performing a tenant to tenant migration, then You might choose to re-import the data for further use in To create: Re-importing the CSV file for use in PowerShell To Exchange Online, execute the script (named Export-O365Groups.ps1 in the example below) and use the -CSVFilename to specify the output file Using the script itself is straightforward – after connecting Finally, we export the results to a CSV file.ĭownload the Export-O365Groups.PS1 script from GitHub here..We concatenate the values in each temporary array – using a newline character Then for both the Members SMTP addresses and the Owners SMTP addresses lines, We address the SMTP address, Identity and Display Name, and This object represents the current line in the Next, we create a new custom object and assign.Sub-loop extracts just the members or owners SMTP address and adds it to two Members and the list of owners for the current group. Within the loop, we then retrieve the list of.We then use a for each loop on the resulting $Groups object to iterate through each.Setting the ResultSize parameter to Unlimited. We first retrieve all Office 365 Groups in the.In the example PowerShell script below this is all performed This is good for user visibility in Excel, and alsoĮasy to convert back into an array if we re-import the file. To avoid this issue, we select a useful unique identifierįor each member, and concatenate all those members into a single item, By default, when youĮxport an array to a row using PowerShell, you’ll usually see System.Object rather than the actual Members, we’ve used a multi-line row in the CSV file. One thing you’ll also notice is that for the list of You’ll see in the example below we’ve exported some key information, like the group’s SMTP address, its identity, display name and then two columns – one for the members and another for containing owners: You might use that output in another script, but in this example we’ll create aĬustom CSV file that’s not only easy to read and edit in Microsoft Excel, butĬan also be re-imported after editing for further scripting.īefore we dive into the PowerShell scripting, we’ll take a quick look at what to expect once the output is open in Excel. Interrogate each group to retrieve membership and owner lists. Information, and then after getting the list of groups in your tenant, The Exchange Online PowerShell module to easily collect Office 365 Group Or, you might want to simply provideĪ weekly report on Office 365 Group membership as part of your efforts to trackĪ great way to do this is by using PowerShell. Require exports of membership information.
Membership, so that you can plan migrations and update the target groups will Office 365 migration then being able to provide reports on current group As Office 365 Groups is one of the core foundations for services like Microsoft Teams, you may need to retrieve information not only about the group, but also about group members and owners and share that with others.įor example – if you need to perform a tenant to tenant As part of day to day administration, or as part of a migration project, exporting information from your Office 365 tenant is a common requirement.