R
RJ454ME
Guest
Im trying to build a SSIS Script Source Component that securely binds to an LDAP but Im not having much success. The error message Im receiving while debugging the data flow where the script source is located is:
"Unknown error (0x80005000) at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll()
at SC_e6e145010da24ed3b4093c4561c9ca0f.ScriptMain.CreateNewOutputRows()
at SC_e6e145010da24ed3b4093c4561c9ca0f.UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers, OutputNameMap OutputMap)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
And the code Im using is listed below and
#Region "Imports"
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports System.DirectoryServices.AccountManagement
Imports System.DirectoryServices
#End Region
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub CreateNewOutputRows()
Dim dEntry As New DirectoryEntry("LDAPS://ldap.com:636/OU=people,DC=organization,DC=com", "USERNAME", "PASSWORD", AuthenticationTypes.Secure)
Dim dSearcher As New DirectorySearcher(dEntry)
Dim dResult As SearchResult
dSearcher.Filter = "(sn=LASTNAME)"
dSearcher.PageSize = 5
dSearcher.SearchScope = SearchScope.Subtree
dSearcher.ReferralChasing = ReferralChasingOption.All
For Each dResult In dSearcher.FindAll()
Dim dUser
dUser = New DirectoryEntry(dResult.Path)
With ActiveDirectoryBuffer
.AddRow()
If dUser.Properties("givenName").Value IsNot Nothing Then
.FirstName = dUser.Properties("givenName").Value.ToString()
Else
.FirstName = "Unknown"
End If
If dUser.Properties("sn").Value IsNot Nothing Then
.LastName = dUser.Properties("sn").Value.ToString()
Else
.LastName = "Unknown"
End If
If dUser.Properties("userPrincipalName").Value IsNot Nothing Then
.UserPrincipalName = dUser.Properties("userPrincipalName").Value.ToString()
Else
.UserPrincipalName = "Unknown"
End If
End With
Next
End Sub
End Class
Any guidance with this would be greatly appreciated
Continue reading...
"Unknown error (0x80005000) at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll()
at SC_e6e145010da24ed3b4093c4561c9ca0f.ScriptMain.CreateNewOutputRows()
at SC_e6e145010da24ed3b4093c4561c9ca0f.UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers, OutputNameMap OutputMap)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
And the code Im using is listed below and
#Region "Imports"
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports System.DirectoryServices.AccountManagement
Imports System.DirectoryServices
#End Region
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub CreateNewOutputRows()
Dim dEntry As New DirectoryEntry("LDAPS://ldap.com:636/OU=people,DC=organization,DC=com", "USERNAME", "PASSWORD", AuthenticationTypes.Secure)
Dim dSearcher As New DirectorySearcher(dEntry)
Dim dResult As SearchResult
dSearcher.Filter = "(sn=LASTNAME)"
dSearcher.PageSize = 5
dSearcher.SearchScope = SearchScope.Subtree
dSearcher.ReferralChasing = ReferralChasingOption.All
For Each dResult In dSearcher.FindAll()
Dim dUser
dUser = New DirectoryEntry(dResult.Path)
With ActiveDirectoryBuffer
.AddRow()
If dUser.Properties("givenName").Value IsNot Nothing Then
.FirstName = dUser.Properties("givenName").Value.ToString()
Else
.FirstName = "Unknown"
End If
If dUser.Properties("sn").Value IsNot Nothing Then
.LastName = dUser.Properties("sn").Value.ToString()
Else
.LastName = "Unknown"
End If
If dUser.Properties("userPrincipalName").Value IsNot Nothing Then
.UserPrincipalName = dUser.Properties("userPrincipalName").Value.ToString()
Else
.UserPrincipalName = "Unknown"
End If
End With
Next
End Sub
End Class
Any guidance with this would be greatly appreciated
Continue reading...