Discussion:
Quest AD Cmdlets - add-QADGroupMember
(too old to reply)
JSC
2008-03-12 18:32:07 UTC
Permalink
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 ***@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.
RichS
2008-03-12 18:46:01 UTC
Permalink
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
Post by JSC
I currently use the Quest AD Cmdlets to give a printout of group membership
$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.
Shay Levi
2008-03-12 20:33:05 UTC
Permalink
You can pipe it directly to Add-QADGroupMember:

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

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Post by RichS
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
Post by JSC
I currently use the Quest AD Cmdlets to give a printout of group
$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.
Loading...