Fix: DNS SOA+NS rename

This commit is contained in:
Alexandre-Simao 2021-06-01 15:30:37 +02:00
parent de77d7d976
commit 7ce08077f8
1 changed files with 22 additions and 5 deletions

View File

@ -126,13 +126,30 @@ Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 192.168.128.1,192
Install-WindowsFeature -Name DNS -IncludeManagementTools -includeallsubfeature
#Add-DnsServerPrimaryZone -NetworkID 192.168.8.0/24 -ZoneFile “192.168.8.1.in-addr.arpa.dns” # Zone secondaire
Add-DnsServerPrimaryZone -Name "asrbd.local" -ZoneFile "asrbd.local.dns" -DynamicUpdate None
Set-DnsServerPrimaryZone -ComputerName SRV-01 -Name asrbd.local -SecureSecondaries "TransferToSecureServers" -SecondaryServers "192.168.128.1"
#Set-DnsServerResourceRecord -NewInputObject srv-01.asrbd.local -OldInputObject srv-01. -ZoneName "asrbd.local" -RRType SOA
$old= Get-DnsServerResourceRecord -ZoneName $allzone.ZoneName -Name @ -RRType Soa
$new = $old.Clone()
$new.RecordData.Name
Add-DnsServerPrimaryZone -ResponsiblePerson "bol@loc.ks" -DynamicUpdate None -ZoneFile asrbd.local.dns -Name asrbd.local
$ns = Get-DnsServerResourceRecord -ZoneName asrbd.local -RRType NS
$nsnew = $ns.Clone()
$nsnew.RecordData.NameServer = "srv-01.asrbd.local"
# Get-DnsServerZone -Name asrbd.local
Set-DnsServerResourceRecord -ZoneName asrbd.local -NewInputObject $nsnew -OldInputObject $ns
$soa = Get-DnsServerResourceRecord -ZoneName asrbd.local -RRType Soa
$soanew = $soa.Clone()
$soanew.RecordData.PrimaryServer = "srv-01.asrbd.local"
$soanew.RecordData.ExpireLimit = (New-TimeSpan -Days 4)
Set-DnsServerResourceRecord -ZoneName asrbd.local -NewInputObject $soanew -OldInputObject $soa
Set-DnsServerPrimaryZone -ComputerName SRV-01 -Name asrbd.local -SecureSecondaries "TransferToSecureServers" -SecondaryServers "192.168.128.1"
Add-DnsServerForwarder -IPAddress 9.9.9.9 -PassThru # Forward