简体   繁体   中英

How do I output a CSV using PowerShell without the “#TYPE” line?

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?

添加NoTypeInformation开关,如下所示:

Export-Csv "../SSIS/Import Data/ADUsers.csv" -NoTypeInformation

您还可以使用:

Export-Csv "../SSIS/Import Data/ADUsers.csv" -NoType

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM