How to Deploy a DNS Server Using PowerShell Commands

Share

In this short article, we’ll take a look at how you can deploy a DNS Server using PowerShell commands. We’ll take you through the entire process, step by step, and explain some of the syntax involved.

As we’ve already mentioned in the past, the DNS Server is an indispensable part of any business network, regardless of how large the company is, and it’s just as vital for home networks too.

Without DNS, the internet and networks we use would be unrecognisable. You would have to memorise hundreds of website names and their corresponding IP addresses, and we’d more than likely end up with a kind of Yellow Pages, where you’d have to look up the IP address for each website you wanted to visit. Sounds hellish, doesn’t it?

That’s why every network should have at least one DNS server and, if possible, a cluster of at least two nodes to prevent network failures.

When it comes to deploying a DNS Server, there are actually two ways to do it. One is by using the graphic interface, and the other is by using PowerShell commands. However, PowerShell commands are much quicker and easier.

 

How to Deploy a DNS Server Using PowerShell Commands

 

Before you start

Whenever you install a new service, there will always be some preparation tasks that you should do beforehand. Normally, these will relate to the design and optimisation of the service or will just help keep things organised so that the installation runs smoothly.

Firstly, the device that you want to install the server on must have a static IP address on at least one network port. If you haven’t set this up, you should do it now.

Secondly, it’s a really good idea to update the PowerShell help and download all the latest help packages. That way, you will have all the available information, support and examples.

To do this, you need to have an internet connection from the server on which you’re planning to install your DNS server. Launch PowerShell with administrator privileges and run the command “Update-help”. This will download all the packages you need.

As always, we also recommend that you update your operating system, applications, etc., but make sure that you don’t install any updates that aren’t relevant. Otherwise, you’ll just end up adding junk to your installation.

 

Deploying a DNS Server Using PowerShell Commands

Once you’ve completed all the preparation steps explained above, you can get started installing the service. First, you need to check whether the DNS Server role and management tools are already installed on the server.

To do this, run PowerShell with administrator permissions and run the command “Get-WindowsFeature – Name *DNS*” (1).

Check whether DNS features are already installed on the server
Check whether DNS features are already installed on the server

This command will look for all the DNS features currently installed on the server. In principle, there shouldn’t be anything already installed, but if there is, you will see an “X” next to each component that has already been deployed on the server.

Once you have checked that nothing has been installed yet, it’s time to install the DNS Server role and management tools. To do this, run the command “Install-WindowsFeature -Name DNS – includeManagementTools” (2).

Run PowerShell to install the DNS service and management tools
Run PowerShell to install the DNS service and management tools

Next, you need to check that everything has been installed correctly. To do this, go run the command “Get-WindowsFeature -Name *DNS*” once again (3).

Check that the DNS Role has been installed correctly
Check that the DNS Role has been installed correctly

Now that the DNS role has been installed, it’s time to deploy the Primary Zone for the DNS Server. To do this, the following command:

“Add-DNSServerPrimaryZone -name <Domain> -zoneFile <Zone> -dynamicupdate NonsecureAndSecure” (4).

For this command:

  • -name <Domain> specifies the domain name.
  • -zoneFile <Zona> specifies the name of the zone.
  • -dynamicupdate NonsecureAndSecure enables all types of updates.

For example, in the case of Jotelulu, this command would be as follows:

Add-DNSServerPrimaryZone -name JOTELULU.COM -zoneFile JOTELULU.COM.DNS -dynamicupdate NonsecureAndSecure

At this point, you should also be able to see this in the DNS Manager graphic interface (5).

Create the Primary Zone for your new DNS
Create the Primary Zone for your new DNS

Amongst other things, this command creates the file “JOTELULU.COM.DNS” within “C:\Windows\System32\dns” (6). So, another way to check that everything has been done correctly would be to navigate to this folder and check that the file has been created.

Check that the entry with the new zone has been created on the disk
Check that the entry with the new zone has been created on the disk

Now that you’ve set up your DNS Server, all that remains is to register your devices, servers, services, etc., so that the DNS Server has something to do.

For example, if you wanted to register a new device (Record A), the command would look like this:

Add-DNSServerResourceRecordA -Name <Name> -ZoneName <ZoneName>  -AllowUpdateAny -IPv4Address <IPAddress>

For this command:

  • -Name <Name> specifies the name that the DNS will return when it is asked to translate the IP address.
  • -ZoneName <ZoneName> specifies the name of the zone where it is registered.
  • -AllowUpdateAny allows updates to the necessary entries.
  • -IPv4Address <IPAddress> specifies the IP address that the DNS will return when it is asked to translate the name.

For example:
Add-DNSServerResourceRecordA -Name PCNacho -ZoneName JOTELULU.COM  -AllowUpdateAny -IPv4Address 192.168.1.200

Once you have done this, you have completed the basic deployment of your new DNS Server.

To learn more about how to manage a DNS Server, check out the next article, where we’ll explain all the things you can do using PowerShell commands.

 

Summary

As you can see, deploying a DNS server using PowerShell is really easy. As long as you know the handful of commands you need, the process is practically effortless. Similarly, you can perform basic management tasks and many others using cmdlets as well.

However, if you come up against an issue, don’t hesitate to contact us so we can give you a hand. We’ll be happy to help.

If you’d like to read a little more about DNS Server, you’ll find a range of articles on our blog.

Thanks for choosing Jotelulu!

Category:Cloud and Systems

Other posts that may interest you

18 de December de 2023
Our Remote Desktop service just keeps getting better! We’ve recently developed some new features to improve service security and
15 de December de 2023
On 22 November, the Jotelulu Roadshow 2023  finally came to a close after seven fantastic events in seven different
12 de September de 2023
Today, we’re going to tell you all about RAID. We’ll explain exactly what it is, take a look at the

Fill out the form and one of our Sales team will contact you soon.

growth@jotelulu.com  |  jotelulu.com 

You can unsubscribe from these communications at any time. For more information,  check our Privacy Policy.