Force to have en-US locales

Feb 8, 2011 at 9:18 AM

Hi all,

I find it not to be user-friendly pushing the en-US regional settings to be able to run PAL.ps1. Instead of requiring en-US locales it's better to set the en-US locales only for the script. This can be done quite easy:

1. Store original locales and get current thread
$global:originalCulture = (get-culture).Name
$global:currentThread = [System.Threading.Thread]::CurrentThread

2. Create functions to set en-US locales and to restore the original one:

Function Set-EnglishLocales
    $usenglishLocales = new-object System.Globalization.CultureInfo "en-US"
    $global:currentThread.CurrentCulture = $usenglishLocales
    $global:currentThread.CurrentUICulture = $usenglishLocales

Function Restore-Locales
    $global:currentThread.CurrentCulture = $global:originalCulture
    $global:currentThread.CurrentUICulture = $global:originalCulture

3. Adjust function Main with calling Set-EnglishLocales after initialization of global variables and calling Restore-Locales after opening HTML report.



Feb 9, 2011 at 4:26 AM

Great idea! The only concern I have with it though is that the Canadians and British like to have their date in DD/MM/YYYY while in the United States we prefer MM/DD/YYYY. I guess we can check the locale and not change it if it is an English locale. I'll give this a shot. Thank you!!!!!

Feb 9, 2011 at 4:45 AM

Hi mafalt,

I added the code to PAL.ps1. Can you test it for me? It is available for download at:

Thank you!

Jun 28, 2011 at 3:00 PM
Edited Jun 28, 2011 at 3:01 PM


Thanks ClintH.

For italian locale the PAL.ps1 it works perfectly.


Sep 28, 2011 at 2:31 PM

Hi all,

They change my laptop, so I install the 2.0.8 version. My laptop have is regional settings in French ( perhaps you saw it with my poor English).

When I start a analyze y have this result.

Your locale is set to: Français (France)
AVERTISSEMENT : Please post errors or problems with this tool to the PAL web
site located at with the following error message
and a brief description of what you were trying to do. Thank you.
La variable « $global:currentThread » ne peut pas être récupérée, car elle n'a
pas été définie.
Au niveau de C:\Program Files\PAL\PAL v2.0.8\PAL.ps1 : 5049 Caractère : 26
+     $global:currentThread <<<< .CurrentCulture = $usenglishLocales
    + CategoryInfo          : InvalidOperation: (global:currentThread:Token) [
   ], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : VariableIsUndefined


To fix this problem I just add the line bellow on the top of le file PAL.ps1

$global:currentThread = [System.Threading.Thread]::CurrentThread


Thank you to Mafalt to help me fix this problem with this post.

Thank you to  ClintH for this great tool.





Oct 4, 2011 at 7:16 AM

Hi Jo,

Are you analyzing a counter log captured in English? I really am trying to get PAL to work for non-English languages, but the primary problem is translating the English counter paths to other languages.

I have no idea why the change you suggest works. Can you tell me more about what you are doing?

Thank you,

Oct 4, 2011 at 7:52 AM

Hi Clint

I am analysing log captured in English ( most of our server are in english)  , but the regional settings of my computer, where I installed PAL V2.0.8, are in French. When I startted the first analyse whith PAL 2.0.8 I recived the error message that I posted the 28 september.

The message La variable « $global:currentThread » ne peut pas être récupérée, car elle n'a pas été définie mean $global:currentThread  is not defined.

So I found lthe post from Mafalt and saw the 2 functions are in PAL v2.0.8 but not the définition of the variable $global:currentThread. So I just Had the line written by Mafalt and it work very fine.

$global:currentThread = [System.Threading.Thread]::CurrentThread

Thank you to you.



Oct 4, 2011 at 9:33 AM

Okay, I'll give it a try. Many users who used a non-English-US locale had problems with parsing the counters, so I reluntantly forced an English-US locale. I am happy to try out the line and see if it works for you. If so, I will include it in future updates. I can certainly use the help in this area of develpment since I am not a profesisonal developer... I am more of an IT professional who can write scripts. :-)

If this works, I'll add a build note giving credit to you. Thank you!