Beware of character [int]160

While working on the OperatingSystem attribute of computer objects in Active Directory, we noticed that some fields have special characters like “™” and “®”.
A few months later, when we exported these fields to a CSV ASCII file, we noticed that there were additional characters.
When we looked in the console, we couldn’t see anything. To help us see what’s going on, I’ve used the following command to convert each character to its decimal value.

(Get-ADComputer -Identity PTU730$ -Properties *).OperatingSystem -split"(?<=\G.{1})" | %  {            
    if ($_ -ne "")            
        $_ + "-> " + [int][char]$_            

character 160

I’ve copied the space between ‘Windows’ and ‘7’ from the edited field in the adsiedit.msc console and pasted it in the console.
Now, here is a tip to split a string using the “\s” that represents a regular expression matching any white space character instead of the simple space character.
character 160

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s