Trying to write powershell script to populate a group of users on a specific databse to an Active Directory group. User in the database are in a child domain, the parent domain contains the group.
I have:
Import-Module ActiveDirectory
$ADGroup = "CN=testgroup,DC=test,DC=com"
$Users = get-mailbox -database server\database -IgnoreDefaultScope | select samaccountname
Add-ADGroupMember -Identity $ADGroup -Members $Users