Is there a Powershell cmdlet or script to query Active Directory if a given domain account (such as "myDomain\myUser") exists?
|
feedback
|
|
You can use the Directory Searcher .net object to do this. Here is a very un-optomized code snippet from one of my utility scripts that has fallen by the wayside.
So you should be able to change the Or don't be lazy like I am and read up on how to construct a proper query :) | |||
|
feedback
|
|
This is what we use to validate accounts. It relies of course on Import-Module ActiveDirectory and either a 2008 R2 DC, or a DC running ADWS:
| |||||||
feedback
|
|
I would grab the Quest AD Roles cmdlets - http://www.quest.com/powershell/activeroles-server.aspx - and user their Get-QADUser cmdlet with the -Identity parameter. For example,
| |||
|
feedback
|