Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell - Set-Culture doesn't seem to change anything

I have a Cloud Service Web Role that I need to run some PowerShell on to ensure the server is always setup in the right culture: en-AU.

The reason for this is that Microsoft could, at anytime, reset the culture values.

When I run:

Get-Culture

I get:

1033             en-US            English (United States)

So then I run:

Set-Culture en-AU

But I still get:

1033             en-US            English (United States)

I have tried many things but nothing seems to really change the culture.

Any help would be great.

like image 734
RuSs Avatar asked Dec 14 '15 05:12

RuSs


People also ask

What does set culture do?

The Set-Culture cmdlet sets a specific culture for the current user account. A culture is known as a locale for unmanaged code development. The information includes the names for the culture, the writing system, the calendar, and formatting for dates and sort strings.

How can I change Cultureinfo in Windows 10?

You can assign to [cultureinfo]::CurrentUICulture / [cultureinfo]::CurrentCulture to change the UI culture / culture for the current thread (only, non-persistently); e.g., the following command outputs the current date and time using the French culture: [cultureinfo]::CurrentCulture = 'fr-FR'; Get-Date.

What is culture in PowerShell?

Description. The Get-Culture cmdlet gets information about the current culture settings. This includes information about the current language settings on the system, such as the keyboard layout, and the display format of items such as numbers, currency, and dates.

What is set in PowerShell?

The PowerShell Set-Item cmdlet changes the value of an item to the value specified in the command. It changes the value of a variable or registry key. The Windows PowerShell FileSystem provider does not support this cmdlet.


2 Answers

The root cause is because you are not running the PowerShell with Administrator privilege.

Set-Culture needs Administrator privilege to be set on the system.

Just run your PowerShell in Administrator mode and your culture will be set to the new one as below:

enter image description here

Hope this helps!

like image 164
juvchan Avatar answered Sep 24 '22 08:09

juvchan


Like petseral said in a comment above:

Changing user locale does not affect already started PowerShell instances.
You have to start new PowerShell process.

like image 41
Luke Avatar answered Sep 21 '22 08:09

Luke