You can use the international module in powershell where we have certain cmdlets to fulfill the requirement.
Internation Module Usage
Internation module Script
Alternative:
Use the below function to set it:
Function Set-RegionSettings
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)]
[String]$Country,
[Parameter(Mandatory=$true)]
[String]$ShortDate,
[Parameter(Mandatory=$true)]
[String]$LongDate,
[Parameter(Mandatory=$true)]
[String]$ShortTime,
[Parameter(Mandatory=$true)]
[String]$TimeFormat,
[Parameter(Mandatory=$true)]
[String]$FirstDayOfWeek
)
$RegKeyPath = "HKCU:\Control Panel\International"
If ($Country)
{
Set-ItemProperty -Path $RegKeyPath -Name sCountry -Value "$Country"
Write-Verbose "Successfully changed value of country."
}
If ($ShortDate)
{
Set-ItemProperty -Path $RegKeyPath -Name sShortDate -Value "$ShortDate"
Write-Verbose "Successfully changed value of short date."
}
If($LongDate)
{
Set-ItemProperty -Path $RegKeyPath -Name sLongDate -Value "$LongDate"
Write-Verbose "Successfully changed value of long date."
}
If($ShortTime)
{
Set-ItemProperty -Path $RegKeyPath -Name sShortTime -Value "$ShortTime"
Write-Verbose "Successfully changed value of short time."
}
If($TimeFormat)
{
Set-ItemProperty -Path $RegKeyPath -Name sTimeFormat -Value "$TimeFormat"
Write-Verbose "Successfully changed value of time format."
}
If($FirstDayOfWeek)
{
Set-ItemProperty -Path $RegKeyPath -Name iFirstDayOfWeek -Value "$FirstDayOfWeek"
Write-Verbose "Successfully changed value of first day of week."
}
$sCountry = (Get-ItemProperty -Path $RegKeyPath -Name sCountry).sCountry
$sShortDate = (Get-ItemProperty -Path $RegKeyPath -Name sShortDate).sShortDate
$sLongDate = (Get-ItemProperty -Path $RegKeyPath -Name sLongDate).sLongDate
$sShortTime = (Get-ItemProperty -Path $RegKeyPath -Name sShortTime).sShortTime
$sTimeFormat = (Get-ItemProperty -Path $RegKeyPath -Name sTimeFormat).sTimeFormat
$iFirstDayOfWeek = (Get-ItemProperty -Path $RegKeyPath -Name iFirstDayOfWeek).iFirstDayOfWeek
$Obj = New-Object -TypeName PSObject -Property @{
"Country" = $sCountry
"Short date" = $sShortDate
"Long date" = $sLongDate
"Short time" = $sShortTime
"Long time" = $sTimeFormat
"First day of week" = $iFirstDayOfWeek
}
Write-Host "The current date and time formats:"
$Obj
}
USAGE:
Set-RegionSettings -ShortDate "M/d/yyyy" -LongDate "dddd,MMMM d,yyyy" -ShortTime "h:mm tt" -TimeFormat "h:mm:ss tt" -FirstDayOfWeek "Sunday" -Country "United States"
Hope it helps.