# Script will set System Regional Settings, Locales and Keyboard Input. # Script will set TimeZone. # Script will start w32time, add all ntp.pool.org servers and register w32time as a service. Forced resync with ntp.pool.org. # # 1. Run PS ISE as Administrator (to start w32time service). # # 2. Set execution policy to run PS Scripts: # > Set-ExecutionPolicy RemoteSigned # # 3. Run script once as Administrator, then for all other users # (For non-admin users you will encounter error for starting w32time service. No worries as service is already started and registered as admin). # # 4. Restart computer (to update Culture). # # CURRENT CONFIGURATION: # NORWEGIAN, BOKMÅL (nb-NO) ## MS TechNet RegionSettings Script: 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 for Computer: |" $Obj } ## Configuration for Regional Settings for Computer: Set-RegionSettings -ShortDate "dd.MM.yyyy" -LongDate "dddd d. MMMM yyyy" -ShortTime "HH.mm" -TimeFormat "HH.mm.ss" -FirstDayOfWeek "0" -Country "Norway" ## System Locale for Computer: Set-WinSystemLocale nb-NO ## Culture (Regional format) for User: Set-Culture -CultureInfo nb-NO ## Home location for User: Set-WinHomeLocation -GeoId 0xb1 ## Keyboard input method for User: Set-WinUserLanguageList nb-NO -force ## Timezone for Computer: Set-TimeZone -name "W. Europe Standard Time" ## Starts w32time service and register time service to run as a service: Start-Service w32time w32tm /register ## Add all ntp.pool.org ntp servers: w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org" ## Force resync: w32tm /resync /force ## Print results: Write-Host " | | The current NTP Configuration for Computer: | " w32tm /query /status Write-Host " | | The current TimeZone for Computer: | " Get-TimeZone Write-Host " | | The current System Locale for Computer: | " Get-WinSystemLocale Write-Host " | | The current Culture (Regional Format) for User: | " Get-Culture Write-Host " | | The current Home Location for User: | " Get-WinHomeLocation Write-Host " | | The current Keyboard Input for User: | " Get-WinUserLanguageList