Skip to content

Instantly share code, notes, and snippets.

@sunnyone
Created November 15, 2013 15:48
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sunnyone/7486486 to your computer and use it in GitHub Desktop.
Save sunnyone/7486486 to your computer and use it in GitHub Desktop.
Changing PowerShell UICulture
# example: Set-PowerShellUICulture -Name "en-US"
function Set-PowerShellUICulture {
param([Parameter(Mandatory=$true)]
[string]$Name)
process {
$culture = [System.Globalization.CultureInfo]::CreateSpecificCulture($Name)
$assembly = [System.Reflection.Assembly]::Load("System.Management.Automation")
$type = $assembly.GetType("Microsoft.PowerShell.NativeCultureResolver")
$field = $type.GetField("m_uiCulture", [Reflection.BindingFlags]::NonPublic -bor [Reflection.BindingFlags]::Static)
$field.SetValue($null, $culture)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment