Saturday, December 29, 2007

Import a list of dns hosts from Windows hosts file

Here is a little script I wrote to import the dns entries in DNS:

For /F "Tokens=1,* Delims= " %%A In (hosts.txt) Do (
Set ip=%%A
Set host=%%B
dnscmd dns_server_name RecordAdd Forward_zone_name %host% A %ip%

1 comment:

Anonymous said...

I tried this it only adds the last host and ip any ideas?