Solved

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

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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
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 …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

690 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