How to add a single user in more than 100 distribution groups Powershell?
$groups = 'Group1','Group2','Group3','Group4'
foreach($group in $groups){
Add-ADGroupMember
-Identity $group
-Members "Username"
}
Via text file format
$groups = Get-Content C:\Users\Administrator\Desktop\grouplist.txt
foreach($group
in $groups){
Add-ADGroupMember
-Identity $group
-Members "username"
}
No comments:
Post a Comment