locked
Powershell command output is not displaying arabic texts RRS feed

  • Question

  • Hello,

    I am running a powershell command to get the last login date of the disabled users as the one shown below. My AD has Arabic texts in some of the user attributes, these arabic texts are not displayed properly in the output. How can get i get the output correctly displayed with the arabic language?

    Get-ADUser -Filter * -SearchBase "ou=users,dc=contoso,dc=local" -ResultPageSize 0 -Prop CN,samaccountname,Description,Office,lastLogonTimestamp | Select CN,samaccountname,Description,Office@{n="lastLogonDate";e={[datetime]::FromFileTime($_.lastLogonTimestamp)}} | Export-CSV -NoType last.csv

    Thanks for your help!

    Best Regards,

    Thursday, March 7, 2013 5:48 AM

Answers

  • Hi,

    You also can add to the Export-CSV the switch 2 "-encoding unicode" to ensure all the special characters are properly exported

    Regards

    Dan

    • Marked as answer by Abu Ameen Thursday, March 7, 2013 6:59 AM
    Thursday, March 7, 2013 6:13 AM

All replies

  • You have to set the locale and culture for your session to Arabic of choice.

    http://technet.microsoft.com/en-us/library/hh852137.aspx


    ¯\_(ツ)_/¯

    Thursday, March 7, 2013 6:10 AM
  • Hi,

    You also can add to the Export-CSV the switch 2 "-encoding unicode" to ensure all the special characters are properly exported

    Regards

    Dan

    • Marked as answer by Abu Ameen Thursday, March 7, 2013 6:59 AM
    Thursday, March 7, 2013 6:13 AM
  • Hello Jrv,

    Thanks for your reply, I have been trying to set the culture in the powershell with various option but didn't succeed. Set-culture command is not seems to be available on Windows 7 or 2008 R2.

    Best Regards,

    Jashy

    Thursday, March 7, 2013 6:56 AM
  • Hello Daniel,

    That worked for me, thanks very much!!

    Best Regards,

    Thursday, March 7, 2013 6:59 AM