Search code examples
.netpowershellquest

powershell or .net - how to receive domain accounts with domain names


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!


Solution

  • 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.