How to Set the Timezone and Configure NTP on Windows Server
Network Time Protocol (NTP) is a highly scalable internet protocol that determines the best time information and synchronizes accurate settings on a computer system. This guide explains how to set the time zone and configure NTP on a Windows Server.
This guide uses Windows Server 2019, but these instructions work on any machine with Server 2016 or later.
Prerequisites
Before you begin:
- Deploy a Vultr Windows Server.
- Connect to the server.
Set the Timezone
- Using the Windows Start Menu, open Server Manager.
- Locate Time zone in the local server properties section.
- Click the current timezone, which is UTC Coordinated Universal Timeby default.
- In the Date and Time window, click Change time zone.
- Expand the Time zone drop-down list.
- Select your preferred timezone. It's recommended to set it to your server location.
- Click OK to save changes.
- Click Apply to load changes on the server.
- Re-open Server Manager, and verify the timezone change.
Optional: Set the Timezone using PowerShell
- From the start menu, open Windows PowerShell, or open the run dialog (Win key + R), type
powershell
in the search bar, and click OK to start PowerShell. Run the following command to check the server timezone.
PS > Get-Timezone
View all available timezones.
PS> Get-Timezone -ListAvailable
To find your target timezone, use the following command to filter by name.
PS> Get-Timezone -ListAvailable | Where-Object {$_.displayname -like "*US*"}
The command above displays all names containing the characters
US
. You can use a different string such as London.Change your timezone.
PS> Set-Timezone -Name "Central Standard Time"
You can also change the timezone by ID.
PS> Set-Timezone -Id "Central Standard Time"
Configure NTP
In addition to setting the timezone, you can also configure Windows to use NTP to synchronize the time.
- Open the Run dialog window by pressing the Windows key (WIN) + R on your keyboard.
- In the search bar, enter
regedit
and click OK to open Registry Editor. Expand the registry navigation tree:
HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services
Expand W32Time.
- Click Config.
- Select AnnounceFlags
- Enter
5
in the Value data field. - Click OK to save changes.
- In the left pane, click Parameters.
Optional: Change the NTP Server
By default, Vultr uses the time.constant.com
time server, located on our high-speed infrastructure. If you want to use a different time server, you can change the value of the NtpServer
parameter by following these steps.
- Double-click NtpServer
Change the value data field to your preferred value. For example, to sync with the United States NTP pool, use:
us.pool.ntp.org
You can find a list of NTP Pool servers at the official website.
Expand TimeProviders.
- Click NtpServer.
- Double click Enabled, change the value data from
0
to1
, and click OK to save changes. - Close the registry editor, open the start menu, and search the keyword
services
. In the services window, scroll through the list, select Windows Time, right-click, and select Restart to apply NTP changes.
Optional: Configure NTP Using PowerShell
If you prefer to use Powershell, you can use the following commands to configure NTP.
- Open PowerShell with administrative privileges.
Check the NTP time synchronization status.
PS> w32tm /query /status
Enter the following command to set the time AnnounceFlags to
5
.PS> Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Config" -Name "AnnounceFlags" -Value 5
(Optional) If you want to use NTP pool servers instead of Vultr's NTP server, run the following command.
PS> Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\w32time\Parameters" -Name "NtpServer" -Value us.pool.ntp.org
Enable NTP Server.
PS> Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer" -Name "Enabled" -Value 1
Restart the Windows Time service.
PS> Restart-Service w32Time
Test NTP synchronization.
PS> w32tm /resync
No comments:
Post a Comment