Getting a list of Windows Language Locales with Windows Powershell

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 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)

Now after having gone through this process my good friend and fellow Windows Powershell MVP Shay Levy mentioned to me there was an easier way! 


Boy THAT was a treat to that as solution! I could even make it into a cheap and dirty Cmdlet (And I do mean Cheap and Dirty) by doing this

Function global:GET-CULTURE { [System.Globalization.Cultureinfo]::GetCultures(“AllCultures”) }


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:\Powershell\locales.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!

About Sean Kearney

"Living the Dream at Microsoft!" A long time ago in a Shell far far away a little guy had a dream, to work at Microsoft. For many years that dream lay by the wayside until his career encountered PowerShell, a technology so cool and easy to use, it made him sing. (Search for Highway to PowerShell and you'll see how badly ;) ) Once encountering PowerShell his career jumped from being a field technician, to working for a Fortune 15 Healthcare corporation, to working for a Microsoft BlackBelt Partner in Ottawa and working with Ed Wilson for many years on the Scripting Blog ... to his dream, handed down from the lands of Microsoft on the day his Dad passed on. A gift from beyond. So to those of you that think dreams don't happen. Think again. PowerShell changed this little person and it will change you too.