2

If I query my AD LDS instance with powershell using my credentials it works great using this code:

Get-ADUser -Filter * `
-SearchBase 'OU=Groups,DC=dev,DC=net' `
-Server 'myserver.mydomain:389'

However when I try connect to the AD LDS instance using SSL by specifying the port 636, I just get the error message:

Get-ADUser : Server instance not found on the given port

Here is the updated (not working) code for ssl/port 636:

Get-ADUser -Filter * `
-SearchBase 'OU=Groups,DC=dev,DC=net' `
-Server 'myserver.mydomain:636'

As a contrast, connecting to the instance using C# works fine using this code (from the same computer as from which I tried the powereshell script):

using(var ctx = new PrincipalContext(
            ContextType.ApplicationDirectory, 
            "myserver.mydomain:636", 
            "OU=Groups,DC=dev,DC=net",
             ContextOptions.Negotiate
                | ContextOptions.SecureSocketLayer 
                | ContextOptions.ServerBind)
) {
    var up = new UserPrincipal(ctx);
    var searchForUser = new PrincipalSearcher(up);
    searchForUser.FindAll()
}

What am I missing to connect to my AD LDS instance using SSL in powershell?

mortb
  • 9,361
  • 3
  • 26
  • 44
  • Did you set it up? https://msdn.microsoft.com/en-us/library/cc725767(v=ws.10).aspx – Micky Balladelli May 09 '17 at 10:43
  • Yes, I've read the article. The SSL connection works when I connect with LDP.exe like it says in the article. It also works when I connect using c# code. The trouble seems to get the SSL connection to work with powershell – mortb May 10 '17 at 06:34

0 Answers0