Handling international WMI clients / servers with Hyper-V

Handling international WMI clients / servers with Hyper-V

  • Comments 3

If you ever try to run a WMI script / program against Hyper-V on a system that is using a language (or locale) different to your own – you may be surprised to see that a number of the properties are localized.  This can cause problems if you are checking for language specific strings.

Take the following example:

When retrieving a list of virtual machines from Hyper-V it is usual to look at the caption – in order to filter out the MSVM_ComputerSystem entry of the parent partition.  You would do this in PowerShell with a command like this:

gwmi MSVM_ComputerSystem -namespace root\virtualization | where {$_.caption -eq "Virtual Machine"}

But if I run this command on a German installation of Windows:


I get no results.  If I remove the where clause you can quickly see the problem:


On this system the caption field is not “Virtual Machine” but is “Virtualler Computer”.

So what should you do to handle this?  Well – the answer is quite simple.  In WMI the server will always try to respond in the language that is used by the client.  Normally the client just picks up the language automatically – but you can manually specify a language to be used.  Here is the same PowerSehll command from above – but this time I am requesting that the server always respond in English:

gwmi MSVM_ComputerSystem -namespace root\virtualization -locale MS_409 | where {$_.caption -eq "Virtual Machine"}

Running this yields the expected results:


A couple of things to note here:


Leave a Comment
  • Please add 3 and 5 and type the answer here:
  • Post
  • I'm trying to get my server to respond to that exact command and it is in German, but I am still getting nothing with the -locale MS_409. Any thoughts as to why that might be?


  • William -

    Does it work if you do not use -locale?



  • Hi Ben,

    on my german Windows 7 its always german:

    PS C:\Users\Administrator> gwmi Win32_TimeZone | select StandardName



    Mitteleuropäische Zeit

    PS C:\Users\Administrator> gwmi Win32_TimeZone -locale MS_409 | select StandardName



    Mitteleuropäische Zeit

    What can I do?



Page 1 of 1 (3 items)