none
Encountered unmappable character error in powershell RRS feed

  • Question

  • Hi,

    I am using a following cmdlets to get all the machines information from AD of our domain. After running this script i get only few machine around (10 % of total machine in AD).

    Error - An error pops up "  Encountered unmappable character error " .

    Que - What does these mean? And what more switches i need to add to get all machines ?  

    Cmdlet used =  Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem | Export-CSV AllWindows.csv -                        NoTypeInformation -Encoding UTF8

    Powershell Version used = 2.0

    please let me know if more information is requird.

    Saturday, January 25, 2014 10:04 AM

Answers

All replies

  • You need to post the full error message.

    ¯\_(ツ)_/¯

    Saturday, January 25, 2014 2:01 PM
  • Complete Error is ---- >

    Get-ADComputer : Cannot marshal: Encountered unmappable character.
    At line:1 char:15
    + Get-ADComputer <<<<  -Filter * -Property * | Select-Object Name,OperatingSyst
    em,OperatingSystemServicePack,OperatingSystemVersion | Export-CSV AllWindows.cs
    v -NoTypeInformation -Encoding UTF8
        + CategoryInfo          : InvalidArgument: (:) [Get-ADComputer], ArgumentE
       xception
        + FullyQualifiedErrorId : Cannot marshal: Encountered unmappable character
       .,Microsoft.ActiveDirectory.Management.Commands.GetADComputer

    --------------------------------------------------------------------------------------------------------

    Tuesday, January 28, 2014 2:53 PM
  • Try just this command:

    Get-ADComputer -Filter *

    Doe this work?


    ¯\_(ツ)_/¯

    Tuesday, January 28, 2014 4:47 PM
  • yes the cmdlet gives me all the computer present in my domain.
    Wednesday, January 29, 2014 10:39 AM
  • Get-ADComputer -Filter *  > test.csv
    I used this as well and it gives complete machines present in my domain

    What may be the issue ?

    Wednesday, January 29, 2014 10:40 AM
  • Then there is nothing wrong.  You must have typed the wrong characters.  If you are running that failed line from a file then the file is likely corrupted or you have a disk error.

    There is nothing wrong with this line:

    Get-ADComputer -Filter * -Property * |
         Select-Object Name,OperatingSystem | 
         Export-CSV AllWindows.csv -NoTypeInformation -Encoding UTF8


    ¯\_(ツ)_/¯

    Wednesday, January 29, 2014 10:45 AM
  • Hi,

    1. I tried to run the complete cmd on my colleagues machine and got the same error " Cannot marshal: Encountered unmappable character. " 

    2. My disk has sufficient space

    3. The complete script only runs on powershell version 3. I tried to upgrade my powershell v 2.0 by installating a Windows6.1-KB2506143-x86.msu but its doesn't get installed neither it shows any missing patch. It just says "failed to installed" after seraching for updates.

    Thursday, January 30, 2014 7:51 AM
  • Hi Amitkumar,

    1. first of all, as was already pointed out, the syntax is correct, which means that's not a problem (and the posted part certainly will run on PowerShell 2).
    2. If the same error occurs on multiple machines, it likely is not the fault of the client, unless they have a common issue by nature (Unlikely in most cases, but sometimes errors occur, either by common incompatibilities or if both machines were deployed using the same image). This would be about the last angle I'd pursue, and only if the full command worked on the DC itself.
    3. if "Get-ADComputer -Filter * > test.csv" actually works, and "Get-ADComputer -Filter * -Properties * > test.csv" fails, the best guess I can manage, is that there's a specific property on an ad object that either contains corrupted data, or a string PowerShell has trouble with.

    To troubleshoot 3., I'd try narrowing down the AD Object. Run both commands after each other, and compare the output with each other. Is the content in the same order up until the one command fails? If yes, try loading the next one with the -Properties * parameter. If it fails, you have the culprit (or at least the first culprit). Manually inspect the object's attribute editor in the ActiveDirectory msc and check for oddities. If that fails to yield good information, try narrowing down which properties you load until you know just what property was causing the trouble.

    Cheers, and good luck with your problem,
    Fred


    There's no place like 127.0.0.1

    Thursday, January 30, 2014 8:27 AM
  • Thanks Fred for the answers and valuable points.

    Thanks very much.

    Friday, January 31, 2014 10:19 AM