Skip to content

Instantly share code, notes, and snippets.

@jhawkwind
Last active September 12, 2019 00:09
Show Gist options
  • Select an option

  • Save jhawkwind/47e466966cd757000371254e4f82e659 to your computer and use it in GitHub Desktop.

Select an option

Save jhawkwind/47e466966cd757000371254e4f82e659 to your computer and use it in GitHub Desktop.
PowerShell DNS commands
This will set all Forward Lookup Zones with the following attributes:
- No Dynamic Updates
- Notify Secondaries of change to all NS Secondaries
- Allow Zone Transfer to NS Secondaries
Get-DnsServerZone | Where-Object {$_.ZoneType -like "Primary" -and $_.IsReverseLookupZone -eq $False} | Select-Object -Property ZoneName,ZoneType | Set-DnsServerPrimaryZone -DynamicUpdate None -Notify Notify -SecureSecondaries TransferToZoneNameServer
Create Secondaries based upon the primary:
Get-DnsServerZone -ComputerName win-olpn33s5q3m.mytest.contoso.com | where {("Primary" -eq $_.ZoneType) -and ($False -eq $_.IsAutoCreated) -and ("TrustAnchors" -ne $_.ZoneName)} | %{ $_ | Add-DnsServerSecondaryZone -MasterServers 172.23.90.136 -ZoneFile "$($_.ZoneName).dns"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment