Powershell commands for DNS Management

Get DNS Record 

Remove All Root Hints 

Get-DnsServerResourceRecord -ZoneName "..roothints" | Remove-DnsServerResourceRecord -Force -ZoneName "..roothints"


Remove A Record 

Remove-DnsServerResourceRecord -ZoneName "MyZone" -RRType "A" -Name "Host01" -RecordData "10.10.3.11"

Search C-Name 

Get-DnsServerResourceRecord -RRType CName -ZoneName "contoso.com" | ? {$_.RecordData.HostNameAlias -eq "hostname.contoso.com." -and $_.HostName -eq "web1.yourdomain.com"

Add C-Name

Add-DnsServerResourceRecordCName -ComputerName DNSSrvr01 -ZoneName 'Myzone' -Name MyHostname -HostNameAlias MyHostnameAlias

Remove C-Name 

Remove-DnsServerResourceRecord  -ZoneName 'Myzone.com' -ComputerName DnSSrvr001 -RRType CName -Name "MyCname" -Force

Where 

  • MyZone is the zone name
  • ComputerName is the DNS Server to which you want to connect. Ignore this switch if you are running from the same server




Comments

Popular posts from this blog

Convert Dynamic IP to static IP in a Windows computer or server

Export Azure VM details to CSV with Tags