this is sort of related to another post. I've got the following script written:
Get-ADUser -Filter * -SearchBase 'DC=aaaa,DC=com' | Export-CSV "ADUsers.csv"
This outputs a CSV file but at the first row of the file reads:
#TYPE Selected.Microsoft.ActiveDirectory.Management.ADUser"
This is messing up SSIS when it tries to read it. Is there any way of not adding that first line?
To do this we can use the Export-CSV function in PowerShell. The Export-CSV function converts PowerShell objects into a CSV string and saves them into a CSV file. If you only need a CSV string, then you can also use the ConvertTo-CSV function in PowerShell.
Go to File > Save As. Click Browse. In the Save As dialog box, under Save as type box, choose the text file format for the worksheet; for example, click Text (Tab delimited) or CSV (Comma delimited).
Static member operator :: To find the static properties and methods of an object, use the Static parameter of the Get-Member cmdlet. The member name may be an expression. PowerShell Copy.
Add the NoTypeInformation
switch, like this:
Export-Csv "../SSIS/Import Data/ADUsers.csv" -NoTypeInformation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With