Solved

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

Posted on 2012-03-22
4
618 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
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Dan Arseneau earned 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

832 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