Retrieving Active Directory information

  • I have a requirement to process AD information through an SSIS package and have hit a problem with the "objectClass" attribute. The ADO.NET source is configured as:

    Screenshot 2022-11-23 at 19.18.09

    and the package has converted all of the output data types to NTEXT. This isn't an issue for most of them as I've converted them to DT_STR using a Derived Column task. However, the "objectClass" is coming through to my SQL table as "System.Object[]".

    I've tried feeding the column into a Script Task and treating it as a BlobColumn and converting through:

    var blobLength = Convert.ToInt32(Row.objectClass.Length);

    var blobData = Row.objectClass.GetBlobData(0, blobLength);

    var stringData = System.Text.Encoding.Unicode.GetString(blobData);

    and all I end up with is "System.Object[]".

    Can anyone advise what I'm doing wrong? I *suspect* it's an issue with the way the data is being pulled (I'm just expecting "user" or "group" as I do when I run a similar query from PowerShell) but I can't see what change I can make.

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • Do you need to do this via ADO / LDAP queries?

    My preferred method would be to combine the AD PowerShell module with DBATools and then use things like Get-ADUser from the AD module with ConvertTo-DbaDataTable then Write-DbaDataTable from DBATools to push it to the DB, but you can then still call the PowerShell from within SSIS via a execute process task to call pwsh.exe and pass it the ps1 script file.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply