Hello i am trying to export my AD users to a CSV of a particular format so that i can upload them to a third party application. So far i can get the users and format them in a table with the format i want using…
Get-ADUser -Filter * -SearchBase "OU=Current Staff,OU=Our Organisation,DC=OurOrg,DC=COM" | Format-Table Name,GivenName,Surname,UserPrincipalName -a -HideTableHeaders
Great i have all the columns and data i need. I just want to export this to a csv that already has the headers ‘Username’ ‘First Name’ Last Name’ ‘Email’. When i pipe the above to…
Export-Csv -Path "C:\Holding\Okta AD Exports\third-party-template.csv"
I get a load of guff in the CSV file and the headers have gone (see atatched). What am i doing wrong? Is there a way to add custom headers when i format the table so i can just export them to a new CSV? I think its because it cant match up the data with the headers but not sure why.
Thanks in advance!