Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Get Group Membership for a User

Closed Thread
 
Thread Tools Display Modes
Old 01-30-2008   #1 (permalink)
LE2 Strat
Guest


 

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?
Old 01-30-2008   #2 (permalink)
alexandair
Guest


 

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
Old 01-30-2008   #3 (permalink)
Kirk Munro [MVP]
Guest


 

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?
Old 01-31-2008   #4 (permalink)
LE2 Strat
Guest


 

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?
>
>
Old 01-31-2008   #5 (permalink)
Kirk Munro [MVP]
Guest


 

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?
>>
>>
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get group membership David Arro PowerShell 2 6 Days Ago 10:47 AM
output group membership on a single line Steven PowerShell 4 05-27-2008 02:59 PM
Group Membership Don D Vista mail 0 09-15-2007 09:31 AM
ADSI and group membership - what am I doing wrong Neil Chambers PowerShell 5 07-14-2007 04:36 AM
Enumerating group membership & ADSI CrazyKiwi PowerShell 7 07-05-2007 07:42 PM








Vistax64.com 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 2005-2008

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