![](https://cdn.userecho.com/characters/68.png?1)
Dumping Adapter Data
What would be the quickest way to dump the data in an adapter so I can compare two adapters? The use case is the replacement of an adapter and the new adapter should be a like-for-like replacement of the original with the same resulting data as a the old one. Would it be a PowerShell script that pulls the adapter via the ldap gateway?
Answer
![](/s/cache/7d/53/7d53b04c16d6ef66897d1a534be84eba.png)
Hey Daniel,
That's correct. The quickest and most supported way is to query the LDAP gateway for the adapter you're needing the data from.
![](https://cdn.userecho.com/characters/68.png?1)
Is there an example script? I'm trying to connect but getting username and password error when that's not the problem.
![](https://cdn.userecho.com/characters/68.png?1)
$Searcher = New-Object -TypeName System.DirectoryServices.DirectorySearcher
$RootOU = "ou=CSVUsers,DC=IdentityBroker"
$Searcher.SearchRoot = New-Object -TypeName System.DirectoryServices.DirectoryEntry -ArgumentList "LDAP://$($RootOU):9999" ,"read","read"
$Searcher.FindAll()
![](https://cdn.userecho.com/characters/65.png?1)
![](https://cdn.userecho.com/characters/68.png?1)
This works
$serverName = "localhost"
$Port = 9999
$UserName = "read"
$Password = "read"
#Load the assemblies
[System.Reflection.Assembly]::LoadWithPartialName("System.DirectoryServices.Protocols")
[System.Reflection.Assembly]::LoadWithPartialName("System.Net")
#Connects to Server on the standard port
$dn = "$ServerName"+":"+"$Port"
$c = New-Object System.DirectoryServices.Protocols.LdapConnection "$dn"
$c.SessionOptions.SecureSocketLayer = $false;
$c.SessionOptions.ProtocolVersion = 3
# Pick Authentication type:
# Anonymous, Basic, Digest, DPA (Distributed Password Authentication),
# External, Kerberos, Msn, Negotiate, Ntlm, Sicily
$c.AuthType = [System.DirectoryServices.Protocols.AuthType]::Basic
$credentials = new-object "System.Net.NetworkCredential" -ArgumentList $UserName,$Password
# Bind with the network credentials. Depending on the type of server,
# the username will take different forms. Authentication type is controlled
# above with the AuthType
Try
{
$c.Bind($credentials);
$baseDN = "OU=csvusers,DC=IdentityBroker"
$scope = [System.DirectoryServices.Protocols.SearchScope]::Subtree
$query = New-Object System.DirectoryServices.Protocols.SearchRequest -ArgumentList $baseDN, $objectFilter, $scope, $null
$var = $c.SendRequest($query)
}
catch
{
Write-host $_.Exception.Message
}
Customer support service by UserEcho
Hey Daniel,
That's correct. The quickest and most supported way is to query the LDAP gateway for the adapter you're needing the data from.