Feb 09 2023 11:30 AM
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 creating users and assigning them to groups has become a nightmare because my team always gets it wrong, so I either have to add or remove a group.
So it occurred to me to create a kind of template to make sure that when they create a user for a specific area they put the groups that corresponds, however still have been wrong, so it occurred to me that it might be possible to create that template in files and through a PowerShell script assign the groups to the user, is that possible?
Thank you in advance,
Feb 09 2023 02:48 PM
@ADumith You could use something like:
$user=Read-Host "Enter SamAccountName"
foreach ($group in Get-Content c:\data\groups.txt) {
}
This will prompt for a username and add all the groups from the groups.txt file to that user.
Feb 09 2023 03:14 PM