Bookmark and Share Subscribe Bookmark and Share

Categories

Advertisement



Update Enom Domain Name via PowerShell (Dynamic DNS Update)

Sep
25


 « »    

DynDNS.org, the awesome service that lets you access your home computers from anywhere, recently announced that it’s getting rid of its free accounts. The most basic account now costs $25 per year.

Fortunately, we can use PowerShell to keep our DNS names updated with the latest public IP Address from our Internet Service Provider for FREE.

In this article I will update the domain name “test.jppinto.com” with the latest public IP address from my Internet Service Provider.

I use Enom.com for my Domain Name services, they charge about the same as GoDaddy and have very useful features for Domain Name management.

Under “General Setting”, you can set a password to access Domain Name settings.

PowerShell Script to Update IP Address for test.jppinto.com. You can use this and schedule to run periodically from a machine where you need the DNS update.


# VARIABLES FOR ENOM SITE
$HostName	= "test"
$DomainName = "jppinto.com"
$Password   = "veryhardpassword"

# GET THE CURRENT PUBLIC IP ADDRESS
$url = "http://checkip.dyndns.com"
$webclient = New-Object System.Net.WebClient
$Ip = $webclient.DownloadString($url)
$Ip2 = $Ip.ToString() 
$ip3 = $Ip2.Split(" ") 
$ip4 = $ip3[5] 
$ip5 = $ip4.replace("","") 
$FinalIPAddress = $ip5.replace("","") 
$webclient.dispose();

Write-Host "`r`n External IP Address is: $FinalIPAddress" -ForegroundColor Green

Write-Host "`r`n Attempting to update: $HostName.$DomainName" -ForegroundColor Yellow

Write-Host "`r`n Attempting to set record using the following URL: `r`n https://dynamic.name-services.com/interface.asp?Command=SetDNSHost&HostName=$HostName&Zone=$DomainName&DomainPassword=$Password&Address=$FinalIPAddress" -ForegroundColor Yellow

# SET THE CURRENT IP ADDRESS ON THE ENOM HOST RECORD
$enomclient = New-Object System.Net.WebClient
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} # TO IGNORE SSL WARNING
$result = $enomclient.DownloadString("https://dynamic.name-services.com/interface.asp?Command=SetDNSHost&HostName=" + $HostName + "&Zone=" + $DomainName + "&DomainPassword=" + $Password + "&Address=" + $FinalIPAddress + "");
$enomclient.dispose();

Write-Host "Result: `n ===================================== `n $result" -ForegroundColor Yellow





    Did I save you time and headaches? Buy me a cup of coffee.
    The more coffee I drink the more articles I can write.