0

I am trying to retrieve a set of users available in Active Directory using LDAP with PowerShell, but I am only getting the response shown below:

[adsi]'LDAP://DomainController.com/DC=DomainName,DC=com'

And it successfully executes with just the two statements below:

distinguishedName : {DC=DomainName,DC=com} 
Path              : LDAP://DomainController.com/DC=DomainName,DC=com?

What should I do now?

Mark Wragg
  • 22,105
  • 7
  • 39
  • 68
Jijo Nair
  • 828
  • 2
  • 11
  • 30
  • Take a look at the [Get-ADUser](https://technet.microsoft.com/en-gb/library/ee617241.aspx) command, it's built specifically to get user details from AD. – henrycarteruk Apr 12 '17 at 10:58

1 Answers1

0

And finally I got the answer using Get-AdUser

The statement is

Get-AdUser -Filter * -SearchBase "dc=yourdomain,dc=com" -server "yourDomainControllerName" | select SamAccountName
Jijo Nair
  • 828
  • 2
  • 11
  • 30
  • `SearchBase` is only needed if you want to query a specific OU, it will search domain root by default. `Server` is only needed if you want to query a _specific_ domain controller, if you don't include this parameter the command will pick a DC automatically. So you can query every user in every OU just by using: `Get-AdUser -Filter * | select SamAccountName` – henrycarteruk Apr 12 '17 at 11:13
  • yes, and exactly I wanted to search a specific server only..Thank you @JamesC. – Jijo Nair Apr 12 '17 at 11:15