I shall never profess to be a developer.   I just like finding answers.  

One of the challenges I had today was finding a list of Language locales in Windows.   I poked about and found an online list posted which could help me out with MDT and programming in the Locales for Non english versions of Windows and Office 365 cached downloads.

The problem was the list links from Microsoft weren’t current.   I’m certain there are updated versions (if you have them, email them please or add them to comments) but I went for a programmatic solution.     But I wanted to ask WINDOWS what list it had available, and I didn’t want to sit down with a Hex editor playing with an NLS file. 

Granted, there is probably a BETTER way, but this was quick and simple.   I went to MSDN.com and did a search for “Locale Table” online.   One of the very first links I found was for the “DataTable.Locale” property in .NET.


I could see it was a part of “System.Globalization.Cultureinfo” and decided to try something quick and simple in Windows Powershell, see if this could be natively accessed.

So into Windows Powershell I tried it as an accelerator



A smile crossed my face at this point, and I started to play.      I tacked on a ‘::’ and played with Tab Autocompletion to see what was available to play with out of the box.   First out of the list was ‘CurrentCulture’



“Oh Cool!” my eyes lit up.  I then wondered if there was a “Get” method available.   A little more online poking on MSDN confirmed this as part of the base Methods.


So I tested with a simple numeric id,  Number 1 (Really, I just took a shot to see if it would work)



Then i tried with a bad one, (again I was guessing at values)



Aha! So all I had to do to get a list of Locales was

Make Errors silent temporarily
Loop through all possible locale values
Capture the list


$locales=For ($lcid=0; $lcid –lt 20500; $lcid++) {  [System.Globalization.Cultureinfo]::GetCultureInfo($lcid)}

Granted this is a REALLY bad example of code.  I am tripping off a CRAP load of errors just to get what I want.  There might even be an easier way to find the information, i just find something “Quick and Dirty” (watching all my Developer friends cringe as overload the stack with errors)

But now what I had was a simple object with the data captured.  I could Sort on it

$locales | SORT-OBJECT

Or export it out as a CSV file for easy reference later

$locales | EXPORT-CSV C:Powershelllocales.csv

With this information finding the names of locales for my Office 365 and MDT deployments was now a piece of cake!

….and All thanks to the Power of Shell!