oh, missed the OU part of the original request.....  There are output
formatting options available in PowerShell but I haven't really
explored those much yet so this really just dumps output to the
screen.  You can add an Out-File or do the old cmd prompt > redirect
to a text file.  One of these days I will explore the out- / export-
options.

------------------------
1. $users =
2. foreach ($user in $users) {
3.  Write-Host "User Name: " ($User).displayname;
4.  Write-Host "Parent Container: " ($user).ParentContainerDN;
5.  Write-Host "Member Of"
6.  (Get-QADUser $user).memberof | Get-QADGroup | ForEach-Object { $_.name}
7.  Write-Host " "
8. }
---------------------

for the $user you could input in a variety of ways.
 $users = get-content "c:\userlist.txt"
 $users = Get-QADGroupMember "Domain Users"

In any case, this was fun while on long boring not terribly relevant
to me conference call.

Steven Peck
http://www.blkmtn.org


On Thu, Jun 12, 2008 at 10:53 AM, Steven Peck <[EMAIL PROTECTED]> wrote:
> I believe the original request was for groups a user account is a memberof.
>
> If you want to get group membership and nested group membership I
> think you would have to go with a top down approach and then
> compare/soprt etc. (note, I could easily be wrong here)
> get-qadgroupmember "Group Name" -indirect
>
>
> So, Eric and I played a bit more with the original request to get it
> slightly more usable.
> -----------------
> 1.  $users =
> 2.  foreach ($user in $users) {
> 3.  ($User).displayname;(Get-QADUser $user).memberof | Get-QADGroup |
> ForEach-Object { $_.name}
> 4.  }
> -----------------
> This gets you the Display Name of the user in question and a list of
> groups they are a memberof as reported in the memberof tab.
>
> for the $user you could input in a variety of ways.
> $users = get-content "c:\userlist.txt"
> $users = Get-QADGroupMember "Domain Users"
>
> To make it prettier you'd want to play with the output formatting a
> bit.  Maybe add a write-host " " for a blank line at the end of the
> loop for something basic.
>
> If you don't have PowerShell setup:
> http://www.blkmtn.org/setting-up-a-PowerShell-environment
> List of two nice starter tutorials:
> http://www.blkmtn.org/powershell-tutorial-series
>
> I am sure there is a 'neater'/more complete way to do this with
> PowerShell but this is what we could toss together in the short run.
>
> Steven Peck
> http://www.blkmtn.org
>
>
> On Thu, Jun 12, 2008 at 9:56 AM, KenM <[EMAIL PROTECTED]> wrote:
>> Just a word of warning if you decide to use this. This will not get the
>> users Primary group or any nested groups the users may belong to. I do not
>> know PS well enough to tell you how to get those but would be interested to
>> see how this is done with PS if anyone knows.
>>
>>
>>
>> On Thu, Jun 12, 2008 at 12:06 PM, Steven Peck <[EMAIL PROTECTED]> wrote:
>>>
>>> With PowerShell and the Quest AD cmdlets it would be more along the lines
>>> of
>>>
>>> ------------
>>> $user = "juser"
>>> (get-QADuser $user ).memberof | get-qadgroup | select-object Name |
>>> export-cvs ./report.csv
>>> -------------
>>>
>>> To do all the users you could loop through them from a list or an AD
>>> query with Get-QADuser.  If you used the list you would avoid random
>>> service accounts, unless your users are in a specific OU and you did
>>> the Get-QADuser on that specific OU.
>>>
>>> Steven Peck
>>> http://www.blkmtn.org
>>>
>>> On Thu, Jun 12, 2008 at 8:13 AM, Eric Woodford <[EMAIL PROTECTED]>
>>> wrote:
>>> > I've used this tool with decent success.. I think it is more Exchange
>>> > focused, but might do your job for AD groups too.. Otherwise PowerShell
>>> > and
>>> > something like get-qadGroup "Groupname" could do it in a rough format..
>>> >
>>> > http://www.imanami.com/products/smartr/
>>> >
>>> > On Thu, Jun 12, 2008 at 7:58 AM, wjh <[EMAIL PROTECTED]> wrote:
>>> >>
>>> >> Hi all,
>>> >>
>>> >> We have a client that will require quarterly reports regarding AD users
>>> >> and the groups to which they belong.  Is there an easy and possibly
>>> >> free
>>> >> tool out there to provide a legible list of users and the groups the
>>> >> user is
>>> >> in.  This isn't any big enterprise AD environment.  Only about 30 users
>>> >> who
>>> >> are currently on an SBS.  I know there are a couple of dsquery commands
>>> >> that
>>> >> will list users and groups, but that doesn't really seem to get me very
>>> >> close to providing a list that basically says this user has these
>>> >> memberships, this user has these memberships, and have it organized by
>>> >> OU.
>>> >>  I just don't want to spend a few hours exporting the info and cutting
>>> >> and
>>> >> pasting to a report so that it is discernible to someone else outside
>>> >> of the
>>> >> AD admin...especially if they will require this quarterly.
>>> >>
>>> >> Thanks for any help.
>>> >>
>>> >> Bill
>>> >>
>>> >> ~ Upgrade to Next Generation Antispam/Antivirus with Ninja!    ~
>>> >> ~ <http://www.sunbelt-software.com/SunbeltMessagingNinja.cfm>  ~
>>> >
>>> >
>>>
>>> ~ Upgrade to Next Generation Antispam/Antivirus with Ninja!    ~
>>> ~ <http://www.sunbelt-software.com/SunbeltMessagingNinja.cfm>  ~
>>
>>
>

~ Upgrade to Next Generation Antispam/Antivirus with Ninja!    ~
~ <http://www.sunbelt-software.com/SunbeltMessagingNinja.cfm>  ~

Reply via email to