Virtual PC Guy's Blog

-- Ben Armstrong, Virtualization Program Manager

Talking about core virtualization at Microsoft (Hyper-V, Virtual PC and Virtual Server).

Tip: Hyper-V + PowerShell + Chinese

Tip: Hyper-V + PowerShell + Chinese

  • Comments 0


While not strictly virtualization related – I did stumble upon something interesting while working on my international WMI blog post yesterday.  In that post I showed some examples of using PowerShell on a German system.  I had originally intended to use Chinese for this post – but I encountered a problematic limitation with PowerShell on Chinese systems.  When I ran this command:

gwmi MSVM_ComputerSystem -namespace root\virtualization

At the PowerShell command line on a Chinese system – all the properties were returned in English instead:

Capture5

But when I ran the same command in the PowerShell Integrated Scripting Environment (ISE):

Capture7

I was able to get correctly localized properties.  After a brief mail exchange with the PowerShell team I discovered that this was all working “as expected”.  Because they cannot display the Chinese characters on the text mode command line interface – they fall back to English.

The problem here is – as I demonstrated in my post yesterday – this means that you could write a script that would run correctly in the command line interface on a Chinese system, but would fail in the Integrated Scripting Environment.

Just wanted to pass this along – if you are ever scripting on a Chinese system – so you are not caught off guard by this change in behavior.

Cheers,
Ben

Leave a Comment
  • Please add 3 and 1 and type the answer here:
  • Post