Denna guide visar hur du med hjälp av PowerShell kan dynamiskt uppdatera din domäns DNS här på Loopia.
#Your info goes here
$hostname = "mindoman.se"
$user = "användarnamn"
$pwd = "lösenord"
#Force TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#Get a page with your current IP
$MyIpPage = Invoke-WebRequest "https://dyndns.loopia.se/checkip"
#Make sure we got a IP back in the response
If ($MyIpPage -match "(?:[0-9]{1,3}.){3}[0-9]{1,3}")
{
 $myIp = $Matches[0]
 #Create a set of credentials
 $secpasswd = ConvertTo-SecureString $pwd -AsPlainText -Force
 $mycreds = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
 #Build up the URL
 $url = "https://dyndns.loopia.se/?hostname=$hostname&myip=$myIp"
 #Invoke the URL
 $resp = Invoke-WebRequest -Uri $url -Credential $mycreds
 $resp.Content #Expected answers that I found "good","nochg","nohost","badauth","notfqdn"
}
Else
{
 #fake response if we didn't get any IP
 "NoDynIP"
}
Ändra mindoman.se till ditt domännamn du vill ställa in IP-adress för, användarnamn till ditt användarnamn på ditt konto till Kundzonen och lösenord till ditt lösenord till Kundzonen.
Tack till Pär på Powershell.today för skriptet!
