Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<#
.SYNOPSIS
This script will set up AD integrated DNS forward and reverse lookup zones
.NOTES
You need a Windows Server 2012 R2 for this script to work.
This script is part of a series to automate your lab on www.dominikbritz.com
#>
#Requires -Version 3
#Requires -RunAsAdministrator
###
### Variables
###
$Zone = 'dominik.lab'
$NetworkID = '192.168.137.0/24'
$ScavengeServer = '192.168.137.100'
$ZoneAgingName = '137.168.192.in-addr.arpa'
Try
{
Set-DnsServerPrimaryZone –Name $Zone –ReplicationScope 'Forest'
Set-DnsServerScavenging –ScavengingState $True –RefreshInterval 7:00:00:00 –NoRefreshInterval 7:00:00:00 –ScavengingInterval 7:00:00:00 –ApplyOnAllZones –Verbose
Set-DnsServerZoneAging $Zone –Aging $True –NoRefreshInterval 7:00:00:00 –RefreshInterval 7:00:00:00 –ScavengeServers $ScavengeServer –PassThru –Verbose
Add-DnsServerPrimaryZone –ReplicationScope 'Forest' –NetworkId $NetworkID –DynamicUpdate Secure –PassThru –Verbose
Set-DnsServerZoneAging -Name $ZoneAgingName –Aging $True –NoRefreshInterval 7:00:00:00 –RefreshInterval 7:00:00:00 –PassThru –Verbose
}
Catch
{
Throw $_
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.