Skip to content

Instantly share code, notes, and snippets.

@vexx32
Created November 2, 2018 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vexx32/04765a62977dc2ef9316aa43f49fb3d3 to your computer and use it in GitHub Desktop.
Save vexx32/04765a62977dc2ef9316aa43f49fb3d3 to your computer and use it in GitHub Desktop.
Trim the header row of a CSV
$Properties = 'GivenName', 'Surname', 'Department', 'EmailAddress', 'Office'
Get-ADUser -Filter 'Department -like "*"' -Properties $Properties |
Select-Object -Property $Properties |
ConvertTo-Csv -NoTypeInformation | # Convert to CSV string data without the type metadata
Select-Object -Skip 1 | # Trim header row, leaving only data columns
Set-Content -Path "c:\emailaddress.csv"
@fernandolgomez
Copy link

This worked perfect!!, Thanks for the help!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment