List AD user with Powershell

AXISHK
AXISHK used Ask the Experts™
on
Any idea how to list out all active users in AD with title contain either Director or Manager ?

Thx
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Pulling from memory, which might be spotty at this hour...


Get-adviser -filter * -properties title -eq director or

Author

Commented:
Doesn't work...

PS C:\Users\administrator.xxxxxx> Get-adviser -filter * -properties title -eq director
Get-adviser : The term 'Get-adviser' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-adviser -filter * -properties title -eq director
+ ~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-adviser:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Commented:
Sorry I'm
Mobile..

Get-ad user -filter * (-properties title -eq "director" or "manager")
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
Get-advisor isn't a comfort.. It's get-aduser


Sorry stupid autocorrect
In case you are still having trouble

Get-ADUser -Properties title -filter {title -eq 'manager' -or title -eq 'director'}

Open in new window

If you use the -eq operator, the match has to be exact.  In other words, "HR manager" would not be a match.  It is better to use the -like operator with wildcards on either side of the keyword.  That way "IT Director" and "Director of IT" both match.

Get-ADUser -Filter {Title -like "*Manager*" -or Title -like "*Director*"} -Properties title

Open in new window

Author

Commented:
Thx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial