A
A
Acidmind2014-03-12 13:10:53
PowerShell
Acidmind, 2014-03-12 13:10:53

How to connect to an LDAP server via PowerShell?

Can you please tell me why when trying to connect to the LDAP server via PowerShell

$dn = [ADSI]"LDAP://192.168.121.11:389/O=SDKGARANT,C=RU"
$dn

An error pops up:
При получении элемента "PSComputerName" произошло следующее исключение: "Произошла ошибка протокола.
"
    + CategoryInfo          : NotSpecified: (:) [format-default], ExtendedTypeSystemException
    + FullyQualifiedErrorId : CatchFromBaseGetMember,Microsoft.PowerShell.Commands.FormatDefaultCommand

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom Brykin, 2019-04-01
@MindPhaser34

I understand that a lot of time has come, but perhaps someone else is relevant.
If we are talking about OpenLDAP, then I saw this on the Internet:
$path = 'LDAP://192.168.14.83:389/dc=domain,dc=ru'
$username = 'admin'
$password = 'password'
Try{
$root = [adsi]::new($path,$username,$password)
$searcher = [adsisearcher]$root
$searcher.findone()
}
Catch{
Write-Host "ERROR: $_"
}
Unix login and password must be .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question