Dynamic IP Address Change Email Notification

This PowerShell script send an email notification to list of users or groups when public IP address changes. ZIP file also has schedule task import XML file that you can easily import and create schedule to run according to your need. No third party software is required!!!

4.6 Star
6,783 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
  • Fonctionne bien
    1 Posts | Last post March 05, 2020
    • Windows serveur 2016 : ok
  • Task Scheduler error 2147750680
    1 Posts | Last post December 14, 2019
    • I'm trying to set up Task Scheduler in Windows 10 but keep getting an error of:-
      An error has occurred for task IPChangeNotification_scheduleTask. Error message: The following error was reported: 2147750680
  • script not on demand
    4 Posts | Last post October 25, 2018
    • thanks for your script.  It works every day at 7am but it does not work if the ip changes during the day.  Do i need to create another task schedule to activate when ipchanges?
    • The scheduled task should be run frequently (e.g. every 5 minutes) so that the script can detect the change of public IP address shortly after it happens.
    • Any chance this could be modified to monitor a DNS name and report if the ip address changed to it?
    • Thanks for this script!  I do an OK job at modifing a script to work for me but a terrible job of writing one from scratch.
      @jdickson34 - I modified this to work with a public DNS name using Resolve-DNSName
      $ip = Resolve-DNSName yourdomain.here -type A  
      $currentip = $ip.IPAddress
      while ($currentip -eq '') {$currentip = Resolve-DNSName gphone.opengear.us -type A}
      That should do it, but tweak to your needs.
  • Question
    3 Posts | Last post July 27, 2018
    • Working great, have is scheduled every 1/2 hour, however every once in a while it reports a blank IP, then next time it corrects itself, my assumption is it couldn't get an IP from the webpage... Have you run into this?
    • djducky, I've updated the script with simple do while loop to make sure that string gets written into the ip.txt file. This change will not send errored emails.
    • Even years later, this is a fantastic find.  I have a few clients that we have to use splashtop on for remote access due to their dynamic IP's from the ISP.  I hate using things like splashtop, I far prefer remote desktop manager.  Now I can set this to go on those servers and open the nonstandard ports we use for RDP, and I can always get in the "right" way...  Thank you so much for this script - works perfectly for me.
  • error when running the scitpt
    1 Posts | Last post May 16, 2017
    • i've noticed the script stoped working few weeks ago ,i had it for more than a year working fine in win7 machine
      found out that my internet provide blocked ipify.org,so i change the lines : $currentip = (New-Object net.webclient).downloadstring("https://wtfismyip.com/text")
      while ($currentip -eq '') {$currentip = (New-Object net.webclient).downloadstring("https://wtfismyip.com/text")}
      but when i run the command in powershell i get in red the following :
      Sending email notification to email@email.com
      Exception calling "Send" with "4" argument(s): "The specified string is not in the form required for a subject."
      At C:\intel\IPchangeNotification.ps1:23 char:15
      +     $smtp.Send <<<< ($sender, $user, $subject, $body)
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : DotNetMethodException
      the script change the text file with the new ip address but i did not get any email
      any ideas ?
  • Blank Alerts?
    1 Posts | Last post April 06, 2017
    • I get occasional alerts with "Previous IP was". The IP did not change and the file still contains said IP. It happens a couple times a day, and it is on a every 5m sched.
  • Windows 10
    2 Posts | Last post October 27, 2016
    • ip.txt is not changing, it keeps saying it is still
    • You did a 'right click on the IPchangeNotification' file and select to run powershell?
  • Works on win 10 as well
    2 Posts | Last post September 05, 2016
    • Hi,
      Just wanted to confirm that the script works properly on win 10 as well.
    • Thanks Tiszavolgyi
  • Suggestion: Use a different website to check IP
    3 Posts | Last post May 14, 2015
    • Thanks for sharing!
      'h**p://api.ipify.org' may be a better alternative. I stopped using 'h**p://checkip.dyndns.com' some time ago because it's not as reliable as it used to be. Sometimes the page takes forever to load and sometimes it never does.
      I'm in no way affiliated with ipify.org or the owner. It's just reliable! Plus, you don't have to strip off any characters in your script.
    • Thank you Jeff, I will definitely consider your suggestion, test it and make script change.
    • Jeff, I've been testing the reliability of the site and downloading IP address every 5 seconds for last couple hours and it seems much more reliable than dyndns.com. In almost every instance, it took about 40-60 milliseconds while dyndns.com took 40 seconds and more. I've even seen few times dyndns.com timed out and failed after 90 seconds.
      Thank you for your suggestion; I've made the change.
  • XML file will not import
    4 Posts | Last post April 15, 2015
    • Hi, Pateljy.
      I am having the same problem as Codeworx1.
      I am running Windows 7 Ultimate and get the
      following error, when trying to import the .xml file.
      "The format of the task is not valid. The following
      error was reported: (2,8):version:1.4"
    • An easy way around this if you have a Windows 8 machine (possibly 7 too) is to import the task on Windows 8 and then change the 'Configure for:' option to another Operating System.  I ran into the same on my WHS 2011 box but changed the setting from my Windows 8 machine so the task was configured for Windows 2008 R2 and then reimported with no issue on my WHS box.
      I'm sure there's probably another way that doesn't involve importing/exporting then reimporting again, but this worked for me. :)
      Hope that helps.
    • I got the same error message and in order to get it to work on my Windows 7 machine I had to change <Task version="1.4" into <Task version="1.2" and remove the sections labelled <DisallowStartOnRemoteAppSession> and <UseUnifiedSchedulingEngine> from the xml file.
      After doing that I was able to import the task into the task scheduler.
    • Please accept my apologies for late response, and I really appreciate the feedback from you all. After investigating, I discover that the XML file was hard coded for specific version number, so I went ahead and updated the file to support general operating systems. Hope this will prevent any importing issues with different operating systems. Please reply if issue still persists.
      Thank you.
1 - 10 of 13 Items