Get the regional settings with Powershell
Get the regional settings with Powershell

Sometimes, it can be useful to get some informations through command line instead of using the GUI.

It is the case for the regional settings. If you want to compare the regional settings between two user accounts, you can both use runas command and the powershell cmdlet get-culture .

First you can launch several powershell prompt with the user accounts you have chosen :
runas /user:domain\user_account1 powershell

runas /user:domain\user_account2 powershell

You can, after that, choose the regional setting you want to compare :

PS> get-culture | format-list -property *


Parent                         : en
LCID                           : 1033
KeyboardLayoutId               : 1033
Name                           : en-US
IetfLanguageTag                : en-US
DisplayName                    : English (United States)
NativeName                     : English (United States)
EnglishName                    : English (United States)
TwoLetterISOLanguageName       : en
ThreeLetterISOLanguageName     : eng
ThreeLetterWindowsLanguageName : ENU
CompareInfo                    : CompareInfo - en-US
TextInfo                       : TextInfo - en-US
IsNeutralCulture               : False
CultureTypes                   : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat                   : System.Globalization.NumberFormatInfo
DateTimeFormat                 : System.Globalization.DateTimeFormatInfo
Calendar                       : System.Globalization.GregorianCalendar
OptionalCalendars              : {System.Globalization.GregorianCalendar, System.Globalization.GregorianCalendar}
UseUserOverride                : True
IsReadOnly                     : False

On each new window, you can now launch the get-culture cmdlet to compare the user regional settings :

  • for the Number format:
    PS > (get-culture).NumberFormat | fl -property *
    
    
    CurrencyDecimalDigits    : 2
    CurrencyDecimalSeparator : .
    IsReadOnly               : False
    CurrencyGroupSizes       : {3}
    NumberGroupSizes         : {3}
    PercentGroupSizes        : {3}
    CurrencyGroupSeparator   : '
    CurrencySymbol           : fr.
    NaNSymbol                : NaN
    CurrencyNegativePattern  : 2
    NumberNegativePattern    : 1
    PercentPositivePattern   : 0
    PercentNegativePattern   : 0
    NegativeInfinitySymbol   : -Infinity
    NegativeSign             : -
    NumberDecimalDigits      : 2
    NumberDecimalSeparator   : .
    NumberGroupSeparator     : '
    CurrencyPositivePattern  : 2
    PositiveInfinitySymbol   : Infinity
    PositiveSign             : +
    PercentDecimalDigits     : 2
    PercentDecimalSeparator  : .
    PercentGroupSeparator    : '
    PercentSymbol            : %
    PerMilleSymbol           : ‰
    NativeDigits             : {0, 1, 2, 3...}
    DigitSubstitution        : None
  • for the Datetime format:
    PS > (get-culture).DateTimeFormat | fl -property *
    
    
    AMDesignator                     :
    Calendar                         : System.Globalization.GregorianCalendar
    DateSeparator                    : .
    FirstDayOfWeek                   : Monday
    CalendarWeekRule                 : FirstFourDayWeek
    FullDateTimePattern              : dddd d MMMM yyyy HH:mm:ss
    LongDatePattern                  : dddd d MMMM yyyy
    LongTimePattern                  : HH:mm:ss
    MonthDayPattern                  : MMMM dd
    PMDesignator                     :
    RFC1123Pattern                   : ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
    ShortDatePattern                 : dd.MM.yyyy
    ShortTimePattern                 : HH:mm
    SortableDateTimePattern          : yyyy'-'MM'-'dd'T'HH':'mm':'ss
    TimeSeparator                    : :
    UniversalSortableDateTimePattern : yyyy'-'MM'-'dd HH':'mm':'ss'Z'
    YearMonthPattern                 : MMMM yyyy
    AbbreviatedDayNames              : {Sun, Mon, Tue, Wed...}
    ShortestDayNames                 : {Su, Mo, Tu, We...}
    DayNames                         : {Sunday, Monday, Tuesday, Wednesday...}
    AbbreviatedMonthNames            : {Jan, Feb, Mar, Apr...}
    MonthNames                       : {January, February, March, April...}
    IsReadOnly                       : False
    NativeCalendarName               : Gregorian Calendar
    AbbreviatedMonthGenitiveNames    : {Jan, Feb, Mar, Apr...}
    MonthGenitiveNames               : {January, February, March, April...}

Reference
Microsoft Technet

Get-Culture
Syntax
Get-Culture [ <CommonParameters>]

Detailed 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.

You can also use the Get-UICulture cmdlet, which gets the current user interface culture on the system, and the Set-Culture cmdlet in the International module. The user-interface (UI) culture determines which text strings are used for user interface elements, such as menus and messages.

Parameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • NoneYou cannot pipe input to this cmdlet.
Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Globalization.CultureInfoGet-Culture returns an object that represents the current culture.
Notes
  • You can also use the $PsCulture and $PsUICulture variables. The $PsCulture variable stores the name of the current culture and the $PsUICulture variable stores the name of the current UI culture.
Examples

Example 1: Get culture settings

This command displays information about the regional settings on the computer.

PS C:\> Get-Culture

Example 2: Format the properties of a culture object

This example demonstrates the vast amount of data in the culture object. It shows how to display the properties and sub-properties of the object.

The first command uses the Get-Culture cmdlet to get the current culture settings on the computer. It stores the resulting culture object in the $C variable.

The second command displays all of the properties of the culture object. It uses a pipeline operator (|) to send the culture object in $C to the Format-List cmdlet. It uses the Property parameter to display all (*) properties of the object. This command can be abbreviated as $c | fl *.

The remaining commands explore the properties of the culture object by using dot notation to display the values of the object properties. You can use this notation to display the value of any property of the object.

The third command uses dot notation to display the value of the Calendar property of the culture object.

The fourth command uses dot notation to display the value of the DataTimeFormat property of the culture object.

Many object properties have properties. The fifth command uses dot notation to display the value of the FirstDayOfWeek property of the DateTimeFormat property.

PS C:\> $C = Get-Culture
PS C:\>$C | Format-List -Property *
PS C:\>$C.Calendar
PS C:\>$C.DateTimeFormat
PS C:\>$C.DateTimeFormat.FirstDayOfWeek
<>
Get the regional settings with Powershell

Leave a Reply

Your email address will not be published.