Hi All,
I have tried researching previous posts, but didn't find anything in relation to adding users to multiple groups from .CSV file import. I have been able to get the below script to work on adding multiple users to a group, but now would like to modify it to add a user to multiple groups. Any assistance would be greatly appreciated.
File comma delimited import file; (*.CSV)
Name | Domain | MemberOf |
<UserName> | <DomainName> | <SecurityGroup1> |
<UserName> | <DomainName> | <SecurityGroup2> |
Import-ModuleActiveDirectory
$members
=Import-CSV'H:\posh\Scripts\Adding Users to Multiple Groups.csv'
$members
|ForEach-Object {Add-QADGroupMember-Identity'SecurityGroup1,SecurityGroup2'-Service'DomainName'-Credential <Cred> -Member$_.samAccountname}
This script is only 3 lines.