سؤال

i need to get all group members which are in a specific OU (usersNewYork), the location of the group is in an other ou (ProxyGroups).

To copy the Users from the Group i would use this script:

Add-ADGroupMember destinationgroup -Members (Get-ADGroupMember sourceGroup)

How is it possible to only copy the members to the Destination Group from the specific OU?

هل كانت مفيدة؟

المحلول

You need to filter your results to only include the group members that you want. There are several ways to do that, but you could try something like this:

Add-ADGroupMember destinationgroup -Members (Get-ADGroupMember sourceGroup | ? dn -match "*OU=usersNewYork,dc=company,dc=com" )
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top