PowerShell: Convert the Bytes Array to String
This TechNet Wiki is based on the forum post: Convert the Bytes Array to String using PowerShell
Issue/Requirement
Can't return string for msExchMailboxGUID
Explore AD Properties
$user = Get-ADUser -Identity 12345 -Properties *
$user.msExchMailboxGuid.GetType().FullName
$user
Returns: System.BYTE[]
Solution
$string = (Get-ADUser -Identity '12345' -Properties *)
$bytes = [System.Text.Encoding]::Unicode.GetBytes($string.msExchMailboxGuid)
[System.Text.Encoding]::ASCII.GetString($bytes)