Time synchronization is paramount when configuring NSX-T and WCP based labs.
Lately I’ve had to configure a windows server as a time server more than once!
I dont enjoy repititive tasks and decided to write a quick powershell script to configure NTP server on a windows server.
The script is straight forward and is based on the content here
Modify the upstream time server by changing time.vmware.com to a NTP server of your choice in the script below.
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Parameters' -Name 'AnnounceFlags' -Value 5
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Parameters' -Name 'NtpServer' -Value 'time.vmware.com,0x1'
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer' -Name 'Enabled' -Value 1
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config' -Name 'MaxPosPhaseCorrection' -Value 172800
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config' -Name 'MaxNegPhaseCorrection' -Value 172800
net stop w32time
net start w32time
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Parameters'
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer'
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config'