Hi, I got a request to generate a powershell script. So, say you have a list of users that you need to know which mailing group they manage, and output the results in an CSV file.
This script will take two input variables :
- InputFile : required parameter, which is the text file containing all usernames that you want to see which mailing groups they manage. Example: c:\users.txt
- Outfile : required parameter, which is the csv file to generate. Example is c:\output.csv
So, say you have a text file named c:\users.txt that contains three lines ( Johns, JeorgeM, AliceO), then you can type the following :
Get-SpecificDGManagers -inputfile c:\users.txt -outfile c:\output.csv
So the output.csv will contain a list of those three users along with all mailing groups they manage.
Download the script
You can download the script from here: Get-SpecificDGManagers
Note: the list of users in c:\users.txt should be the samaccountnames and not the displaynames of the users 🙂 this is to ensure uniqueness.
Note: If no output is available ( the users are not managing any groups, then no csv will get generated). Run the script in verbose mode to see more info 🙂
Note: run it from Exchange Management PowerShell with user that has read access only.