Solved

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

Posted on 2012-03-22
4
619 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

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 article explains the steps required to use the default Photos screensaver to display branding/corporate images
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
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 …

856 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