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?