Changing Windows Time and Date Format

Full example based on p.campbell's answer:

Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sCountry -Value "Germany";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sLongDate -Value "dddd, d. MMMM yyyy";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortDate -Value "dd.MM.yyyy";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortTime -Value "HH:mm";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sTimeFormat -Value "HH:mm:ss";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sYearMonth -Value "MMMM yyyy";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name iFirstDayOfWeek -Value 0;

To set the settings of the default user instead of the system, use HKU:\.DEFAULT\Control Panel\International. For a specific user use HKU:\(UserSID)\Control Panel\International.

To get the SID of the current user, use

([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value

If you don't have HKU: mapped, use

New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS

Based on p.campbells's answer, but with all properties:

Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sCountry -Value "Germany";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sLongDate -Value "dddd, d. MMMM yyyy";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortDate -Value "dd.MM.yyyy";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sShortTime -Value "HH:mm";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sTimeFormat -Value "HH:mm:ss";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name sYearMonth -Value "MMMM yyyy";
Set-ItemProperty -Path "HKCU:\Control Panel\International" -Name iFirstDayOfWeek -Value 0;

I believe the settings you are looking for are located in:

HKEY_CURRENT_USER\Control Panel\International\sLongDate
HKEY_CURRENT_USER\Control Panel\International\sShortDate
HKEY_CURRENT_USER\Control Panel\International\sTimeFormat
HKEY_CURRENT_USER\Control Panel\International\sYearMonth

So,

Set-ItemProperty -Path "HKCU:\Control Panel\International" 
                 -name sLongDate -value "<Whatever format you'd like>"

Tags:

Powershell