Search code examples
powershellcsvvisual-studio-2012flat-file

Retrieving AD users from Powershell and exporting to csv, then Import csv to SQL via SSIS


Below is the Powershell CMD I use to export AD users to CSV. For some reason when i use SSIS to create a new flat file connection and use the exported CSV all the cell values contain "". When I open the CSV the cells dont show the Quotes.

In the Flat File Connection Manager Editor Preview every cell that has data shows "Mydata"

Is there something wrong with my powershell CMD? or am i missing something when configuring the Flat File connection when creating my SSIS package

    Get-ADUser -Filter {(Name -notlike "*(Administrator)")}  -Properties SamAccountName,DisplayName,Department,EmailAddress,OfficePhone,StreetAddress,State,PostalCode,Enabled | Select-Object SamAccountName,DisplayName,Department,EmailAddress,OfficePhone,StreetAddress,State,PostalCode,Enabled | export-csv -path c:\SSIS\ADUsersExported.csv -NoTypeInformation -Encoding "UTF8"

Solution

  • I did not Enter " for the Text Qualifier in the Flat File Connection Manager Editor Under General\format\Text Qualifier.

    enter image description here