?
Solved

Powershell command/script to list all users who have a given manager.

Posted on 2012-03-22
4
Medium Priority
?
624 Views
Last Modified: 2012-03-22
I need a way to list all the users of a given manager. It can be a native powershell or using QAD tools.

Here is what I tried?

$Mgr = Get-Qaduser MyManager
get-qaduser | where {$_.Manager -eq $Mgr}

But that did not return any results.
0
Comment
Question by:Gary Dewrell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Dan Arseneau earned 2000 total points
ID: 37754388
Try..

Get-User -ResultSize unlimited | where {$_.manager -match "name"}

Open in new window

0
 
LVL 27

Expert Comment

by:KenMcF
ID: 37754477
I would not use that filter
"Get-User -ResultSize unlimited | where {$_.manager -match "name"}"

What this is doing is pulling every single user in your AD and then piping to the where. If you have a large AD env this will take awhile


Use this

Get-Qaduser -manager USERNAMEOFMANAGER
0
 
LVL 27

Expert Comment

by:KenMcF
ID: 37754486
ANd to add to your original. It was not working becuase it is looking for a DN

SO this would work but very inefficient



$Mgr = (Get-Qaduser MyManager).DN
get-qaduser | where {$_.Manager -eq $Mgr}
0
 
LVL 12

Author Closing Comment

by:Gary Dewrell
ID: 37754489
Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here's a look at newsworthy articles and community happenings during the last month.
Let's recap what we learned from yesterday's Skyport Systems webinar.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question