How can i make automatic dynamic AAAA and A record registration from Windows Network Settings from IPv6 and IPv4 settings: where do i enter Registration URL or Update Key directly?
$Names = @("vEthernet (L0)", "vEthernet (L1)")
$Hostnames = @("computer_name.connection_0.domain.zone","computer_name.connection_1.domain.zone")
$Passwords = @("key_0","key_1")
$ipv6Addresses = @()
for ($Counter = 0; $Counter -lt 2; $Counter++) {
$Name = $Names[$Counter]
$Hostname = $Hostnames[$Counter]
$Password = $Passwords[$Counter]
$ipv6Address = Get-NetIPAddress -InterfaceAlias $Name -AddressFamily IPv6
if ($ipv6Address) {
$filteredAddress = $ipv6Address | Where-Object {
$_.PrefixOrigin -eq 'RouterAdvertisement' -and
$_.SuffixOrigin -eq 'Link'
}
if ($filteredAddress) {
$Foundipv6Address = $filteredAddress.IPAddress
$Foundipv6AddressFeet = "$Foundipv6Address"
$ipv6Addresses += $Foundipv6Address
Write-Host "Found IPv6 addresses:" $Foundipv6AddressFeet
Write-Host
$URL = "https://$Hostname"+":$Password@dyn.dns.he.net/nic/update?hostname=$Hostname&myip=$Foundipv6AddressFeet"
Write-Host $URL
Write-Host
curl.exe $URL
} else {
Write-Host "IPv6 address $Name not found"
}
} else {
Write-Host "Interface $Name not found"
}
}
if ($ipv6Addresses.Count -gt 0) {
Write-Host "Found IPv6 addresses:"
$ipv6Addresses | ForEach-Object { Write-Host " - $_" }
}
This is a powershell script, that is working fine in scheduler in Windows.
It updates two dynamic AAAA records every 5 minutes from the scheduler starting from windows laod using account 'NT\Network Service'.
I have allowed to run 'unsigned powershell scripts'.
powershell .\AAAA_by_Name.ps1
This is a cmd-file that is running in the Windows Scheduler.