Welcome › Forums › General PowerShell Q&A › Powershell to update DNS SOA & TTL modification?
- This topic has 0 replies, 1 voice, and was last updated 9 months, 1 week ago by
IT Engineer.
Viewing 0 reply threads
-
AuthorPosts
-
-
April 17, 2020 at 7:23 am #219879
Hi All,
I need some help in modifying this below Powershell to add DNS server entry from a list of domains and setup the SOA TTL into 15 minutes.
So far I cannot figure it out how to:
1. Set the SOA TTL to just 15 minutes.
2. set the SOA number to be YYYYMMddd01PowerShell123456789101112131415161718192021$DomainNames = 'CorporateProduct1.com'$PrimaryDNSServer = 'PRDSVRDNS01-VM'$SecondaryDNSServer1 = 'PRDSVRDNS02-VM'$SecondaryDNSServer2 = 'PRDSVRDNS03-VM'#Create Primary DNS Forward Lookup ZoneAdd-DnsServerPrimaryZone -ComputerName $PrimaryDNSServer -Name $DomainNames -ZoneFile $DomainNames.dns -DynamicUpdate None -ResponsiblePerson "domains.$($ENV:USERDNSDOMAIN.ToLower())"Set-DnsServerPrimaryZone -ComputerName $PrimaryDNSServer -Name $DomainNames -SecureSecondaries "TransferToSecureServers" -SecondaryServers "$([System.Net.Dns]::GetHostAddresses($SecondaryDNSServer1).IPAddressToString)", "$([System.Net.Dns]::GetHostAddresses($SecondaryDNSServer2).IPAddressToString)"# Set the Public DNS servers to replicate toAdd-DnsServerResourceRecord -ComputerName $PrimaryDNSServer -Name '@' -ZoneName $DomainNames -NS -NameServer "ns1.$ENV:USERDNSDOMAIN"Add-DnsServerResourceRecord -ComputerName $PrimaryDNSServer -Name '@' -ZoneName $DomainNames -NS -NameServer "ns2.$ENV:USERDNSDOMAIN"Add-DnsServerResourceRecord -ComputerName $PrimaryDNSServer -Name '@' -ZoneName $DomainNames -NS -NameServer "ns3.$ENV:USERDNSDOMAIN"#Let the Forward lookup zones created completelyStart-Sleep -Seconds 5#Replicate the Forwardlookup zones into two additional Public DNS serversAdd-DnsServerSecondaryZone -ComputerName $SecondaryDNSServer1 -MasterServers [System.Net.Dns]::GetHostAddresses($PrimaryDNSServer).IPAddressToString -Name $DomainNames -ZoneFile "$DomainNames.dns"Add-DnsServerSecondaryZone -ComputerName $SecondaryDNSServer2 -MasterServers [System.Net.Dns]::GetHostAddresses($PrimaryDNSServer).IPAddressToString -Name $DomainNames -ZoneFile "$DomainNames.dns"I’m also not sure if @Splatting is even worked on the above query, hence I am asking it here.
Thank you in advance.
-
This topic was modified 9 months, 1 week ago by
IT Engineer.
-
This topic was modified 9 months, 1 week ago by
-
-
AuthorPosts
Viewing 0 reply threads
- The topic ‘Powershell to update DNS SOA & TTL modification?’ is closed to new replies.