Forum Discussion
charlie4872
Jan 26, 2024Brass Contributor
Exporting Users Phone Number From AD Not Formatting Correctly In .CSV File
Hello, I am running a script to export users from AD using the below command
Get-ADUser -Filter * -SearchBase "OU=XXX,OU=United States,OU=North America,DC=domain,DC=local" -Properties * |Select -Property Samaccountname,Name,Userprincipalname,telephonenumber | Export-CSV ".\users.csv" -NoTypeInformation -Encoding UTF8
When the script is done the telephone number is not showing correctly. I believe this has something to do with the + and - in the phone number not getting translated correctly. For example a user who has the phone number +1-111-222-3333 comes out in the exported .csv file as something like -7386. I have tried formatting the cells after the export to use different formats but it still does not format it correctly. Is there a way to have the script export the telephonenumber attribute as a string or something so it looks correct in the .csv file?
No RepliesBe the first to reply