Adding a new sub domain?

Aug 2, 2011 at 9:22 PM

We have a lot of DNS zones to manage on a day to day basis, and to make things easier, I've started putting together a script to take care of one zone in particular that requires daily creations of sub-domains with A, CNAME, TXT, and MX records.

During my research, I came across your PS cmdlet. After playing with it for a little bit, I can get it to everything I need except one thing - Create a New Sub Domain in an existing zone. I could be missing something, but I thought I would ask. Is this possible?


Thanks for your time, and a big thanks for putting this cmdlet together!!




Aug 12, 2011 at 8:22 AM

Hi Jesse,

Sorry for the late reply.

If you're adding a sub-domain within an existing zone the syntax is this:

New-DnsRecord -Name name.subdomain -Zone domain.example -IPAddress

If you want to create a delegation you need to create NS records:

New-DnsRecord -Name subdomain -Zone domain.example -Hostname

Note that with the last command, any existing records within the sub-domain will be purged, replaced with the NS record(s) you define.