Forum Discussion
ADumith
Feb 09, 2023Iron Contributor
Assigning groups to AD user.
Hello everyone, I have the following situation: In my work we are always hiring people and depending on their position they may be assigned to different groups. So the process of creatin...
Feb 09, 2023
ADumith You could use something like:
$user=Read-Host "Enter SamAccountName"
foreach ($group in Get-Content c:\data\groups.txt) {
Add-ADGroupMember -Identity $group -Members $user
}
This will prompt for a username and add all the groups from the groups.txt file to that user.