Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用powershell通过SSL连接到AD LDS_Powershell_Ssl_Adam_Adlds - Fatal编程技术网

无法使用powershell通过SSL连接到AD LDS

无法使用powershell通过SSL连接到AD LDS,powershell,ssl,adam,adlds,Powershell,Ssl,Adam,Adlds,如果我使用我的凭据使用powershell查询我的AD LDS实例,那么使用以下代码将非常有效: Get-ADUser -Filter * ` -SearchBase 'OU=Groups,DC=dev,DC=net' ` -Server 'myserver.mydomain:389' 但是,当我尝试通过指定端口636使用SSL连接到AD LDS实例时,我只收到错误消息: Get-ADUser:在给定端口上找不到服务器实例 以下是ssl/端口636的更新(不工作)代码: Get-ADUser

如果我使用我的凭据使用powershell查询我的AD LDS实例,那么使用以下代码将非常有效:

Get-ADUser -Filter * `
-SearchBase 'OU=Groups,DC=dev,DC=net' `
-Server 'myserver.mydomain:389'
但是,当我尝试通过指定端口636使用SSL连接到AD LDS实例时,我只收到错误消息:

Get-ADUser:在给定端口上找不到服务器实例

以下是ssl/端口636的更新(不工作)代码:

Get-ADUser -Filter * `
-SearchBase 'OU=Groups,DC=dev,DC=net' `
-Server 'myserver.mydomain:636'
作为对比,使用C#连接到实例可以使用以下代码(与我尝试powereshell脚本的计算机相同):


在powershell中使用SSL连接到AD LDS实例时,我缺少了什么?

您设置了吗?是的,我读过这篇文章。SSL连接在我连接LDP.exe时起作用,如文章中所述。当我使用c#代码连接时,它也可以工作。问题似乎在于如何使SSL连接与powershell一起工作
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()
}