$user.memberof | get-qadgroup | foreach {Add-qadgroupmember -identity $_.DN
- member <user identity> }
should work for you
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk
"JSC" wrote:
> I currently use the Quest AD Cmdlets to give a printout of group membership
> of a particular user by doing the following:
>
> $user = Get-QADUser USER...@domain.com
> $user.memberOf | Get-QADGroup | ft name
>
> Is there a way to pipe the results of the group membership and use the
> addQADgroupmember CMdlet to make another account mirror the exact same group
> membership as the first account?
>
> Example: username A is a member of group 1, 2, and 3. Using the 2nd line of
> code above, it prints out the groups 1, 2, 3. Then take those groups and add
> username B to those exact same groups.
(Get-QADUser UsernameA).memberof | Add-QADGroupMember -Member UsernameB
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
> I haven't got access to a test machine at the moment but something
> like
>
> $user.memberof | get-qadgroup | foreach {Add-qadgroupmember -identity
> $_.DN - member <user identity> }
>
> should work for you
>