Now we've worked with distribution groups in the earlier recipe, we know the basics of them. Now we want to utilize PowerShell for backing up the distribution groups and the membership. There could be a lot of reasons for this, but a migration is the most likely one I can think of; examples include a cross-forest migration or, from Exchange on-premises to Exchange Online without having the full Exchange Hybrid with synchronizing all objects, and so on.
In this recipe, we will find all distribution groups and their members to extract that information; we will also be able to restore this information.