Title says it all. I'm trying to create a PowerShell script that will do the following:
Search for all members of Group A
Remove from Group A
Add to Group B
Any tips are appreciated!
Title says it all. I'm trying to create a PowerShell script that will do the following:
Search for all members of Group A
Remove from Group A
Add to Group B
Any tips are appreciated!
The script should look like this (not tested!)
Import-Module ActiveDirectory
Get-ADGroupMember -Identity "GroupA" |
ForEach-Object {Add-AzADGroupMember -Identity "GroupB" -Members $_
Remove-ADGroupMember "GroupA" $_ -Confirm:$false
}
https://docs.microsoft.com/en-us/powershell/module/addsadministration/get-adgroupmember?view=win10-ps
https://docs.microsoft.com/en-us/powershell/module/addsadministration/add-adgroupmember?view=win10-ps
https://docs.microsoft.com/en-us/powershell/module/addsadministration/remove-adgroupmember?view=win10-ps
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten
9 people are following this question.