通过批量或类似的方式设置Windows嵌入式标准的互联网时间服务 [英] Setting internet time server on windows embedded standard through batch or similar

查看:242
本文介绍了通过批量或类似的方式设置Windows嵌入式标准的互联网时间服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PLC运行windows嵌入式标准,我在这里安装和修改了我公司的软件,作为安装过程的一部分(今天全部是手册)。我现在正在自动化此过程。



我想通过批处理将日期和时间属性 - > Internet时间服务器设置为pool.ntp.org文件或类似命令



w32tm



无法识别。
我试过使用命令



net time /setsntp:pool.ntp.org / p>

它返回



该命令成功完成。使用命令



net time / querysntp



还返回



当前的SNTP值为:pool.ntp.org
命令已成功完成。



但是,当我在日期和时间属性 - >互联网时间手动检查这些更改时,这些更改不会被反映服务器,甚至没有重启。所以我不知道我正在使用的命令是否实际工作?还有另一种方法来实现吗?



编辑:
以下.bat文件可以正常工作。注册表中的更改只将服务器添加到列表中,并将其设置为默认值,但不会启用同步。

REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers / v0/ t REG_SZ / dpool.ntp。 org/ f
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers / ve / d0/ f
NET TIME /setsntp:pool.ntp .org

解决方案

在regedit中查看以下路径: p>

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers



将您的服务器添加到该文件夹​​作为字符串值 - 或者您可以修改默认的MS提供的,如果你愿意的话。检查您的默认服务器(我的显示为0),就像Windows将首先使用的那样,并将其放在列表的顶部。



如果您删除默认的MS服务器并添加自己的确保您在列表中至少有2台服务器,或者尝试&访问时间&日期'设置/ Internet时间设置选项卡在时钟之内它将崩溃,从不显示列表。



如果要配置任何特殊的ntp选项,那么看看这个路径;



HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time



重新启动Windows时间服务,你应该很好。没有理由不能通过.bat或power shell来编写这个文件。


I have a PLC running windows embedded standard where I make some installations and modifications specific to my company's software as part of our installation process (which is all manual today). I'm now in the process of automating this procedure.

I want to set the Date and time properties->internet time server to pool.ntp.org through a batch file or similar. The command

w32tm

is not recognized. I've tried using the command

net time /setsntp:pool.ntp.org

which returns

the command completed succefully..

Using the command

net time /querysntp

also returns

The current SNTP value is: pool.ntp.org The command completed successfully.

But these changes are not reflected when I manually check them under Date and time properties->internet time server, not even after a restart. So I'm left wondering if the command I'm using is actually working? Is there another way to accomplish this?

EDIT: The following .bat file works. The changes in the registry alone only added the server to the list and made it default but it didn't enable syncing. REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers /v "0" /t REG_SZ /d "pool.ntp.org" /f REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers /ve /d "0" /f NET TIME /setsntp:pool.ntp.org

解决方案

Have a look in regedit under the following path;

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers

Add your server(s) into that folder as String Values - or you could modify the default MS provided ones if you prefer. Check what you 'default' server is (mine shows as 0) as that's the one Windows will use first, and put at the top of the list in the time settings.

If you delete the default MS servers and add your own ensure you have at least 2 servers in the list or when you try & access the 'Time & Date' setting / Internet time setting tab within the clock it will crash and never display the list.

If you want to configre any special ntp options then have a look at this path;

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time

Restart the 'Windows Time' service and you should be good to go. There is no reason you couldn't script this either through a .bat or power shell.

这篇关于通过批量或类似的方式设置Windows嵌入式标准的互联网时间服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆