2011/03/16

Blueprint script to create DNS records in AD

Create this following code as a bat. You can than run the following (assuming you called the bat adddns.bat):
>adddns mynewhost01 0 10

This will create the records for a host 192.168.0.10 (in the example)

@echo off
:start
if "%1" == "" goto error
if "%2" == "" goto error
if "%3" == "" goto error

dnscmd abinbev.demo /recordadd yourdomain.com %1 A 192.168.%2.%3
dnscmd abinbev.demo /recordadd %2.168.192.in-addr.arpa %3 PTR %1.yourdomain.com

goto end

:error
echo name
echo adddns.bat host1 2 213
goto end
:end

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.