I have a script that is creating unified groups. We use these as ‘forwarders’ after an employee leaves. I have to modify the script to use the -emailaddresses parameter for setting the email addresses.
Here is the scenario:
- CSV Input
- Up to 2 email addresses in addition to the primary. Unknown when the csv is input
- Script is iterating through the ProxyAddresses property in AD to determine if the additional address(es) exist and capture them.
- Populate PrimarySmtpAddress and either or both of the additional addresses into the EmailAddresses parameter.
- Create the group with the primary address and then iterate through and add the others as they are found.
- Capture all addresses (Primary and additional) into an object and add the object. Not sure this would work though as the object would have empty values if the additional email addresses do not exist and this could error?
Looking for suggestions and recommendations for the best way to do this.