'Add the email address for multiple security groups from a csv file using powershell
I have a csv file with a list of groups with their email addresses. I need add these email addresses to the mail attribut security group in AD (no exchange). In the csv the first column is labeled group (###.testgroup) second column is labeled mail (###[email protected]).
When I run this script
Import-CSV -path 'C:\Temp\test.csv' | ForEach-Object {Set-ADGroup -Identity $_.group -Replace @{mail="$_.mail"}}
It returns the following instead of the actual email address the mail field.
@{group=###.testgroup; mail=domain.com}.mail
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
