Posted in

add a new DNS record on a Windows Server 2022

To add a new DNS record on a Windows Server 2022 using PowerShell, you can use the Add-DnsServerResourceRecord cmdlet. Here is a step-by-step guide:

  1. Open PowerShell with Administrator privileges:

    • Right-click the Start button and select “Windows PowerShell (Admin)”.
  2. Use the Add-DnsServerResourceRecord cmdlet:

    • The syntax for adding a DNS A record is as follows:


      Add-DnsServerResourceRecordA -Name "<RecordName>" -ZoneName "<ZoneName>" -IPv4Address "<IPAddress>"
    • Replace <RecordName> with the name of the DNS record you want to add.

    • Replace <ZoneName> with the name of your DNS zone (e.g., “example.com“).

    • Replace <IPAddress> with the IP address associated with the DNS record.

  3. Example:

    • To add an A record for test.example.com with an IP address of 192.168.1.100 in the example.com zone, you would run:


      Add-DnsServerResourceRecordA -Name "test" -ZoneName "example.com" -IPv4Address "192.168.1.100"
  4. Confirm the record:

    • You can confirm that the DNS record has been added successfully by querying the DNS server. Use the Resolve-DnsName cmdlet to check the record:


      Resolve-DnsName test.example.com

This command should return the IP address 192.168.1.100 if the record was added correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *