how to get only the group members of an specific OU and move/migrate to a destination group


hello,

i need group members in specific ou (usersnewyork), location of group in other ou (proxygroups).

to copy users the group use script: 

add-adgroupmember destinationgroup -members (get-adgroupmember sourcegroup)

how possible copy members destination group specific ou?

possibly try filtering down members list so:

$destinationgroup = "mygroup" $sourcegroup = "someothergroup" $ou = "ou=myou,dc=domain,dc=com" $members = get-adgroupmember $sourcegroup | where-object { $_.distinguishedname -like $ou } add-adgroupmember $destinationgroup -members $members


if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.

don't retire technet



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file