Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 help and support Forum Windows 8 Forum Vista Tutorials

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 > Vista Newsgroup Archive > Misc Newsgroups > PowerShell

Vista - Get Group Membership for a User


 
 
01-30-2008   #1 (permalink)
LE2 Strat


 

Get Group Membership for a User

I am trying to use the Quest AD stuff to get all of the groups a particular
user belongs to.

I am getting errors if I try to pipe the get-qadgroup after doing a
get-qaduser -identity USERNAME



Anybody got an idea?
My System SpecsSystem Spec
01-30-2008   #2 (permalink)
alexandair


 

Re: Get Group Membership for a User

On Jan 30, 10:06 pm, LE2 Strat <LE2St...@xxxxxx>
wrote:
Quote:

> I am trying to use the Quest AD stuff to get all of the groups a particular
> user belongs to.
>
> I am getting errors if I try to pipe the get-qadgroup after doing a
> get-qaduser -identity USERNAME
>
> Anybody got an idea?
$strUser = get-qaduser -SamAccountName $strUserName
$strUser.memberof

-aleksandar
http://powershellers.blogspot.com
My System SpecsSystem Spec
01-30-2008   #3 (permalink)
Kirk Munro [MVP]


 

Re: Get Group Membership for a User

Do you want this recursive (i.e. do you want to see every group that the
user belongs to through direct and indirect membership)? Or do you only
need to know what groups the user is a direct member of?

Also, are you concerned about dynamic query-based DLs (which won't show up
in the .memberOf property) or just regular security and distribution groups?

--
Kirk Munro [MVP]
Poshoholic
http://www.poshoholic.com

"LE2 Strat" <LE2Strat@xxxxxx> wrote in message
news:40C1F55B-F5C5-429C-B420-3102ED4D6252@xxxxxx
Quote:

> I am trying to use the Quest AD stuff to get all of the groups a
> particular
> user belongs to.
>
> I am getting errors if I try to pipe the get-qadgroup after doing a
> get-qaduser -identity USERNAME
>
> Anybody got an idea?
My System SpecsSystem Spec
01-31-2008   #4 (permalink)
LE2 Strat


 

Re: Get Group Membership for a User

Just the groups that the user is a direct member of (If that group is nested
inside another group, I don't see to see that informaiton). Just the
security/distributions groups a member is directly a member of.

"Kirk Munro [MVP]" wrote:
Quote:

> Do you want this recursive (i.e. do you want to see every group that the
> user belongs to through direct and indirect membership)? Or do you only
> need to know what groups the user is a direct member of?
>
> Also, are you concerned about dynamic query-based DLs (which won't show up
> in the .memberOf property) or just regular security and distribution groups?
>
> --
> Kirk Munro [MVP]
> Poshoholic
> http://www.poshoholic.com
>
> "LE2 Strat" <LE2Strat@xxxxxx> wrote in message
> news:40C1F55B-F5C5-429C-B420-3102ED4D6252@xxxxxx
Quote:

> > I am trying to use the Quest AD stuff to get all of the groups a
> > particular
> > user belongs to.
> >
> > I am getting errors if I try to pipe the get-qadgroup after doing a
> > get-qaduser -identity USERNAME
> >
> > Anybody got an idea?
>
>
My System SpecsSystem Spec
01-31-2008   #5 (permalink)
Kirk Munro [MVP]


 

Re: Get Group Membership for a User

Ok, then Alexandair's approach should give you what you want. If you want
more than just the distinguished names of those groups, you can pipe the
memberOf list to Get-QADGroup, like this:

$user = Get-QADUser 'Poshoholic'
$user.memberOf | Get-QADGroup

This will take each of the distinguished names in memberOf and pass them
along the pipeline to Get-QADGroup one at a time. Get-QADGroup accepts a
distinguished name of a group as input, so this allows it to retrieve the
actual AD group object with all of it's properties. Note that you will only
see three properties in the output of this script: name, type and dn. If
you want to see all properties that are available, you can do this:

$user.memberOf | Get-QADGroup | Format-List * | more

Note that this will generate a lot of output.

--
Kirk Munro
Poshoholic
http://www.poshoholic.com

"LE2 Strat" <LE2Strat@xxxxxx> wrote in message
news94B48E1-3FF7-4E35-8940-FE8B3FBDED11@xxxxxx
Quote:

> Just the groups that the user is a direct member of (If that group is
> nested
> inside another group, I don't see to see that informaiton). Just the
> security/distributions groups a member is directly a member of.
>
> "Kirk Munro [MVP]" wrote:
>
Quote:

>> Do you want this recursive (i.e. do you want to see every group that the
>> user belongs to through direct and indirect membership)? Or do you only
>> need to know what groups the user is a direct member of?
>>
>> Also, are you concerned about dynamic query-based DLs (which won't show
>> up
>> in the .memberOf property) or just regular security and distribution
>> groups?
>>
>> --
>> Kirk Munro [MVP]
>> Poshoholic
>> http://www.poshoholic.com
>>
>> "LE2 Strat" <LE2Strat@xxxxxx> wrote in message
>> news:40C1F55B-F5C5-429C-B420-3102ED4D6252@xxxxxx
Quote:

>> > I am trying to use the Quest AD stuff to get all of the groups a
>> > particular
>> > user belongs to.
>> >
>> > I am getting errors if I try to pipe the get-qadgroup after doing a
>> > get-qaduser -identity USERNAME
>> >
>> > Anybody got an idea?
>>
>>
My System SpecsSystem Spec
 

Get Group Membership for a User problems?



Thread Tools


Similar topics to: Get Group Membership for a User
Thread Forum
Re: Enumerate User's AD Group Membership VB Script
Re: Enumerate User's AD Group Membership VB Script
Script to query user information based upon group membership VB Script
Get group membership PowerShell
Group Membership Vista mail


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 47 48 49 50