Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Quest AD Cmdlets - add-QADGroupMember

Reply
 
Old 03-12-2008   #1 (permalink)
JSC


 
 

Quest AD Cmdlets - add-QADGroupMember

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 USERNAME@xxxxxx
$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.

My System SpecsSystem Spec
Old 03-12-2008   #2 (permalink)
RichS


 
 

RE: Quest AD Cmdlets - add-QADGroupMember

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
--
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:
Quote:

> 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 USERNAME@xxxxxx
> $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.
My System SpecsSystem Spec
Old 03-12-2008   #3 (permalink)
Shay Levi


 
 

RE: Quest AD Cmdlets - add-QADGroupMember


You can pipe it directly to Add-QADGroupMember:

(Get-QADUser UsernameA).memberof | Add-QADGroupMember -Member UsernameB

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> 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
>
> "JSC" wrote:
>
Quote:

>> 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 USERNAME@xxxxxx
>> $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.
>>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: Quest cmdlets : get-qaduser PowerShell
Quest cmdlets - x64 Compliant ? PowerShell
Quest AD cmdlets RC1 PowerShell
Can't add Quest AD cmdlets PowerShell
Quest AD Cmdlets PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46