'Which cmdlet to use for creating a domain (folder) under a Primary Zone on the DNS-server?

As the below picture shows, I want to use a PowerShell cmdlet to create/delete domains (folders) under a primary zone in the Windows DNS Server. I've have not been able to figure out which DNSServer cmdlet to use ref. docs.microsoft.com

As the picture below shows I have manually created "sandkasse.no" (sandbox), and added using the GUI "dev.sandkasse.no", "prodfix.sandkasse.no" etc. But not yet figured out which cmdlet that will create yet another one for me.

Win 2016

enter image description here



Solution 1:[1]

I just figured it out. If you check your zone with the following command, you can see, that the records in the "New Domains" in the GUI are just shown as normal records with a "." in between (like sandkasse.no)

Get-DnsServerResourceRecord -ZoneName "contoso.com"

Actually, if you just add a "DnsServerResourceRecord" like shown below with a Name "test.test" it will show up in the GUI like a "New Domain" (In my case I created a CNAME "test.test").

Add-DnsServerResourceRecord -CName -Name "test.test" -HostNameAlias "Host34.lab.contoso.com" -ZoneName "Contoso.com"

Resources to lookup

Add-DnsServerResourceRecord

Get-DnsServerResourceRecord

German: administrator.de: Powershell DNS neue Domain anlegen

"If you only create an empty domain (subdomain in your zone) with the GUI; the file is not updated! When you stop & start the DNS server, you'll even see that the empty domain is gone. So that means that using 'New Domain..." from the GUI really doesn't do anything in your zone, until you add a record."

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HeyThereSmile