How to export email addresses of distribution list members in powershell

This is a quick one-liner I had to figure out to respond to a request to have the actual email addresses of all members in a distribution list. To complicate it further, I always use nested groups.
I wasn’t having much luck doing it via exchange powershell but I did find a way to run it in powershell on one of our DC’s.
The first step is to load ActiveDirectory in your powershell session
Import-Module ActiveDirectory
this line will get members of group_name and recursively go through any other groups that are members. It will then output only the user email. You can always add more fields to select-object if needed.
get-adgroupmember group_name -recursive | get-aduser -properties mail | select-object mail