Skip to content

How to Install the DNS Server Role with PowerShell Print

  • 0

How to Install the DNS Server Role with PowerShell

Applies to: Windows Server 2019, 2022 and 2025.

Windows DNS Server can host authoritative zones and provide recursive resolution. Domain controllers commonly use AD-integrated DNS, while standalone servers require a separate zone and replication plan.

DNS and DHCP changes can interrupt authentication and remote access. Preserve console access, export current settings and test from representative clients. Managed Windows VPS services are available at networkmanager.info.

Prerequisites

  • Assign a static address.
  • Choose authoritative and recursive responsibilities.
  • Confirm firewall and upstream resolver design.
  • Take a configuration backup when adding DNS to an existing server.

Procedure

Step 1: Inspect role state

Query the feature.

Get-WindowsFeature DNS

Step 2: Install DNS

Include management tools.

Install-WindowsFeature DNS -IncludeManagementTools

Step 3: Inspect service

Confirm startup and status.

Get-Service DNS

Step 4: Review existing configuration

List zones and server settings.

Get-DnsServerZone
Get-DnsServerForwarder

Step 5: Allow monitoring

Add DNS service and event logs to monitoring.

Verification

Resolve a local or authoritative test name and query server state.

Get-WindowsFeature DNS
Get-Service DNS
Resolve-DnsName localhost -Server 127.0.0.1

Rollback

Remove-DnsServerRole is not the standard cmdlet; use Uninstall-WindowsFeature DNS only after exporting zones and confirming no clients or AD role depends on the service.

Operational notes

Removing DNS from a domain controller without a migration plan can break domain discovery.

Official references

Explore Netcloud24 Canada managed Windows Server hosting.


Was this answer helpful?

« Back