Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

About Registry Modification ntp time synchronization Server

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Today, one of my classmates asked me if there was any batch processing for modifying the address of the Windows time synchronization server. I searched it on the Internet, and it didn't seem to be much, so I wrote one if it was wrong. Echo 172.18.22.222 time.cqvie.edu.cn > > C:\ Windows\ System32\ drivers\ etc\ hosts reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ SOFTWARE\ Windows\ CurrentVersion\ Servers / v 0 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 1 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 2 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 3 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 4 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL _ MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 5 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 6 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 7 / d time.cqvie.edu.cn / t REG_SZ / f reg add HKEY_LOCAL_MACHINE SYSTEM\ CurrentControlSet\ Services\ W32Time\ Parameters / v ntpserver / d time.cqvie.edu.cn 0x9 / t REG_SZ / f reg add HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpClient / v SpecialPollInterval / d 0x12c / t REG_DWORD / f gpupdate / force / wait:0 pause copy the above into a text document Then change the suffix name to bat format. Here is the parsing of the content.

Echo 172.18.22.222 time.cqvie.edu.cn > > C:\ Windows\ System32\ drivers\ etc\ hosts

This line parses the domain name with a hosts file, because I used the domain name in the batch, and my address does not exist in the DNS server, so I need to add resolution.

Of course, I am a student of Chongqing Engineering Vocational and Technical College, so I use it directly.

The domain name of our alma mater, ha. If you don't mind directly showing the IP address or DNS resolution, this line can be ignored. Just replace the domain name in the document with the IP address of the self-built NTP server.

Reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 0 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 1 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 2 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE \ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 3 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 4 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 5 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 6 / d time.cqvie.edu.cn / t REG_SZ / freg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ DateTime\ Servers / v 7 / d time.cqvie.edu.cn / t REG_SZ / f

These things cover the domain name of the NTP server that comes with Windows. In fact, it would be good to decide according to your actual situation. Of course, if you modify it in batches, it is best to cover all of them. After all, you don't know which one.

The address is now the default NTP server address for Windows. Of course, if you are not using a domain name, just replace the domain name address with the NTP server IP address.

Reg add HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ Parameters / v ntpserver / d time.cqvie.edu.cn,0x9 / t REG_SZ / f

This line still modifies the address of the NTP server, and if you don't need a domain name, you can replace it with the IP address of NTP.

Reg add HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W32Time\ TimeProviders\ NtpClient / v SpecialPollInterval / d 0x12c / t REG_DWORD / f

This line sets the time interval for synchronization. What I set here is synchronization every 5 minutes. You can set it according to your own needs. The unit of time is seconds. In 0x12c, you can only replace 12c.

This is the hexadecimal that is used. We can convert the decimal to hexadecimal through Windows's own calculator. The 12c here is 300 seconds.

Gpupdate / force / wait:0pause

These two things are the way to make the registry take effect immediately without a restart. Of course, pause means pause. If you don't need a pause, we don't want it.

Add to it.

If you need to synchronize immediately, you can execute the command in cmd

W32tm / registernet start "windows time" net stop w32timenet start w32timew32tm / resync

Similarly, you can replace the domain name with the server IP address without a domain name, of course, you can also save it in batches, and then add boot self-startup, which can achieve boot synchronization time. Er, this computer room environment is OK to use.

Of course, the only command for time synchronization is w32tm / resync, and the rest is just in case.

I hope you will correct me a lot!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report