Reputation: 5697
I was asking few days ago how to combine Lotus Notes data with data from Active Directory. I was sure, that there will be no problem with retrieving user accounts from AD, but actually, there is one problem. I used the Get-QADUser to receive user names, but as I later realize, there are no user accounts. I have only winxp and win2003 server, so I can't use Active Directory Module for PowerShell and it's Search-ADAccount cmdlet.
I'm trying Get-QADUser, but with no effect. This command lists domain names in this form:
Markus Elen user CN=Markus Elen,OU=Users,OU=CENTRAL,DC=pb,DC=sk
but I need name of user and his domain account.
Is it possible to do it with QADUser or other cmdlet other than Search-ADAccount? Thank you!
Upvotes: 1
Views: 540
Reputation: 126902
PowerShell lets you query AD natively by using the [ADSISEARCHER] type shortcut (it wraps the System.DirectoryServices.DirectorySearcher type). Here's an example of getting all users from your default domain.
$searcher = [adsisearcher]'(objectCategory=user)(objectClass=user)"
$searcher.FindAll()
Upvotes: 1
Reputation: 34418
Get-QADUser
returns an object with lots of properties, which does include the user account name. Try
Get-QADUser markus |fl
to see them all. You probably want either
Get-QADUser markus |ft Name, LogonName
Get-QADUser markus |ft Name, NTAccountName
although if you're reading these programmatically you should accept the objects directly from Get-QADUser and query the properties directly from them.
Upvotes: 1