Share via


Tip: Hyper-V + PowerShell + Chinese

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