I need to export all of the email addresses from my Local Windows Groups and Users that are active to a CSV file. How do I do this? I am new to Powershell, but I would like to write a PowerShell script to do this. I began by importing the activedirectory module and was able to execute some scripts.
Here is a link that does almost everything except this writes the output to the console instead of CSV. And it freezes and doesn't return to the command prompt after running:
groups and users to console solution
So in this CSV, I'd like to see each group header followed by its member email addresses.