Смена времени windows server

1. Change Date and Time Windows Server 2022 2019, 2016 from CMD
2. Change Date and Time Windows Server 2022 2019, 2016 from PowerShell


Windows Server plays an essential role in organizations of all kinds thanks to each of its functions, roles and characteristics that allow comprehensive, global and functional administration of each object of the organization, we are talking about users, computers, printers, shared resources and plus..

When Windows Server 2016, 2019 or 2022 is installed, the time and date are assigned based on the user’s location, this is something natural in this process but there may come a time when it is necessary to change the date and time for some task administrative or because the server changes its geographical location, be careful not to do this operation in an environment where the users are still working, since we can cause access problems to the shared resources.

There is the possibility of changing the date and time from CMD or PowerShell and we will see how to achieve it in Windows Server, in this case version 2022 but it applies equally to other versions..

To stay up to date, remember to subscribe to our YouTube channel!

SUBSCRIBE ON YOUTUBE

1. Change Date and Time Windows Server 2022 2019, 2016 from CMD

Step 1

First of all we open CMD, this will open as administrator by default in Windows Server:

image

Step 2

We will use the following syntax to change the time on the server:

 time HH/SEC/MIN AM/PM 

image

Step 3

In this case we have established a PM time, we validate that the change has been applied:

image

Step 4

It is possible to use the 24-hour format without the AM/PM, we just have to enter the time in that format in the console:

image

step 5

We validate the change:

step 6

To change the date in Windows Server from CMD, we are going to use the following syntax:

 date MM-DD-YY 

image

step 7

Validate the change in the taskbar:

2. Change Date and Time Windows Server 2022 2019, 2016 from PowerShell

Step 1

Now it is time to use the PowerShell console, for this we open PowerShell, it will open with administrative privileges by default:

image

Step 2

We list the current date with the command:

 get-date 

image

Step 3

Modify the date and time with the following command on a single line:

 set-date -date “day, # day of month of year HH:MM:SS” 

image

Step 4

Now we validate the date and time change:

step 5

In the console we can list the current time zone:

 get-wmiobject win32_timezone 

image

In case it must be modified, it will be necessary to use the tzutil command for it.
This is the way we can change the date and time in Windows Server from CMD or PowerShell.


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

Windows Timezone Settings

  1. Using the Windows Start Menu, open Server Manager.
  2. Locate Time zone in the local server properties section.
  3. Click the current timezone, which is UTC Coordinated Universal Timeby default.
  4. In the Date and Time window, click Change time zone.
  5. Expand the Time zone drop-down list.
  6. Select your preferred timezone. It’s recommended to set it to your server location.
  7. Click OK to save changes.
  8. Click Apply to load changes on the server.
  9. Re-open Server Manager, and verify the timezone change.

Optional: Set the Timezone using PowerShell

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

  2. Run the following command to check the server timezone.

     PS > Get-Timezone
  3. 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.

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

  1. Open the Run dialog window by pressing the Windows key (WIN) + R on your keyboard.

  2. In the search bar, enter regedit and click OK to open Registry Editor.

  3. Expand the registry navigation tree:

    HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services

  4. Expand W32Time.

  5. Click Config.

  6. Select AnnounceFlags

  7. Enter 5 in the Value data field.

  8. Click OK to save changes.

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

  1. Double-click NtpServer

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

  3. Expand TimeProviders.

  4. Click NtpServer.

  5. Double click Enabled, change the value data from 0 to 1, and click OK to save changes.

  6. Close the registry editor, open the start menu, and search the keyword services.

  7. In the services window, scroll through the list, select Windows Time, right-click, and select Restart to apply NTP changes.

    Restart the Windows Time Service

Optional: Configure NTP Using PowerShell

If you prefer to use Powershell, you can use the following commands to configure NTP.

  1. Open PowerShell with administrative privileges.

  2. Check the NTP time synchronization status.

     PS> w32tm /query /status
  3. 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 
  4. (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
  5. Enable NTP Server.

     PS> Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer" -Name "Enabled" -Value 1
  6. Restart the Windows Time service.

     PS> Restart-Service w32Time
  7. Test NTP synchronization.

     PS> w32tm /resync

Next Steps

You have successfully set the timezone and configured NTP on Windows Server 2019. If you plan to have other machines on a Vultr VPC use your NTP server, allow port 123 in the Windows Server Firewall. For further information, refer to the following guides.

  • Official NTP Documentation
  • List of database TimeZones
  • Configure the Firewall on Windows Server 2019
  • Create A Vultr Virtual Private Cloud (VPC)

The correct date, time, and time zone are one of the first settings a Windows Server should have. In today’s article, we’ll see how we can change time, date, and time zone through the graphical environment, command line and Powershell.

Set time, date, and time zone settings from the graphical interface

The process is very simple. Right-click the time field in the lower right corner and then click the Adjust date/time option.

Configure Date, Time and Time Zone settings in Windows Server 2016

In the settings window, you can change the time, date, and time zones of each Windows Server. I do not think there is a need for further guidance as it is a simple process.

Configure Date, Time and Time Zone settings in Windows Server 2016

Alternatively, you can open the time and date settings window by clicking on the corresponding field in the Local Server section of the Server Manager.

Configure Date, Time and Time Zone settings in Windows Server 2016

As you will see, in this case, opens the “old” management window through which you can set the time, date and time zone.

Set time, date, and time zone settings on command prompt

By typing the following command will open the time and date setting window, even in a Server Core installation.

To display the current date and time, enter the following commands.

Configure Date, Time and Time Zone settings in Windows Server 2016

To set time and date, you can use the corresponding Time and Date commands at the command line.

In Windows Server 2012 have been added the Timezone Utility (tzutil) tool that allows us to display and set a time zone through the Windows command line.

First, open the command line with administrator privileges and make sure you are in the System32 folder.

To display the current Windows Server Time Zone, type the following command.

Configure Date, Time and Time Zone settings in Windows Server 2016

To display all available time zones, type the following command.

Configure Date, Time and Time Zone settings in Windows Server 2016

To change the current time zone in Windows Server, type the following command, between the doubles, enter the time zone as it appears in the list of the previous command. For example, for the Greek time zone type:

tzutil /s "GTB Standard Time"

To confirm that the time zone has changed, you can see the corresponding registry entry by using the following command from within the same command-line window.

reg query HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

Configure Date, Time and Time Zone settings in Windows Server 2016

[pro_ad_display_adzone id=”1683″]

Set time, date and time zone settings on Powershell

To view the current date and time, type the following command.

Configure Date, Time and Time Zone settings in Windows Server 2016

To set the time and date through Powershell the process is very easy. Use the following command as an example by changing the date and time values.

Set-Date -Date "06/06/2017 14:45"

Alternatively, you can simply type the Set-Date command and promptly you will be prompted to enter the server’s date and time.

Configure Date, Time and Time Zone settings in Windows Server 2016

To view the current time zone through Powershell, type the following command.

Configure Date, Time and Time Zone settings in Windows Server 2016

Before changing the time zone, you will need to know the right name. Type the following command to see all available time zones in Windows Server.

Get-TimeZone -ListAvailable

Configure Date, Time and Time Zone settings in Windows Server 2016

To change the time zone, use the following command along with the corresponding time zone of your server.

Set-TimeZone -Name "GTB Standard Time"

При попытке сменить часовой пояс некоторые пользователи могут столкнуться с ошибкой: «Продолжение невозможно. У вас нет разрешения на выполнение этой задачи. Обратитесь за помощью к сетевому администратору».

Есть 2 способа решения проблемы:

  1. Кликните «Пуск», наберите в строке поиска timedate.cpl, запустите оснастку от имени администратора, установите необходимые настройки и сохраните.
  2. Или разрешите изменение часового пояса в политиках безопасности. Для этого кликните «Пуск», наберите в сроке поиска gpedit.msc, запустите оснастку и перейти по адресу Конфигурация компьютера —> Конфигурация Windows —> Параметры безопасности —> Назначение прав пользователя. Откройте политику «Изменение часового пояса» и добавьте пользователя Admin. Сохраните настройки и перезагрузить облачный сервер.

Дата обновления 19.06.2024

В Windows Server 2019 и 2022 по умолчанию указан сервер времени time.windows.com. В некоторых средах он недоступен, но точное время нужно, но заменить сервер времени по умолчанию через пользовательский интерфейс затруднительно. Заменить сервер времени можно отредактировав реестр с помощью PowerShell (от имени администратора):

Проверяем текущий сервер:

w32tm /query /source
time.windows.com,0x8

Заменяем на нужный сервер времени:

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters" -Name "NtpServer" -Value "pool.ntp.org,0x8"

После перезапустим службу, чтобы изменения вступили в силу и выполним синхронизацию времени:

Restart-Service w32time
w32tm /resync

Отправка команды синхронизации на локальный компьютер
Команда выполнена успешно.

Готово.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как установить alt store на айфон через windows
  • Mpv for windows 10
  • Как удалить проводник на windows 10
  • Как подключиться по ssh через консоль windows
  • 0xc004f034 ошибка активации windows 11