[ntp:questions] Setting ntp servers with ntpd windows

Ryan Malayter malayter at gmail.com
Thu Aug 9 19:59:06 UTC 2007

On Aug 8, 11:41 am, shane-dated-1187195937.8dd... at cm.nu wrote:
> I use the ntp installer for Windows and have installed to a number of
> machines here.  Just wondering if there is a better way of doing the ntpd
> server config than manual entries in ntp.conf.  For example on our
> Unix-based systems, we use a dhcp server and use the ntp-servers dhcp
> option.  The dhclient-script on the Unix clients rewrites ntp.conf with the
> servers obtained from dhcp making configuration changes much easier.  Is
> there any way to do this under the Windows client?

If you have a Windows domain (meaning a Windows Server with Active
Directory), your client workstations and non-domain controller servers
will by default use the Windows time service to automatically get time
from the domain controllers. So only the domain controllers need to
have any configuration done.

If you want to use the "real" ntpd on windows, I know of no way to
modify the Windows DHCP client service to execute a script. I think
the Windows DHCP client itself simply ignores any DHCP options it is
not interested in. Our DHCP server returns type 042 records for time
servers, but those are not stored in the Windows system registry as
far as I can tell.

However, it appears you can get at the data somehow with the windows
DHCP client API:

You could do this with any scripting language that can make win32 API
calls. VBscript cannot do so without a C++ COM wrapper, nor can
JavaScript. A small C program might be your easiest route if you
really want to do this.

If you don't want to mess with Win32 API stuff, I think the simplest
solution would be to have a startup script on all machines that
updates the ntpd configuration file from a network share. You can then
have that shared config file manually updated, or update the network
share from one of your UNIX machines. Your DHCP time server
configuration should be fairly static.

More information about the questions mailing list