Dynamic IP Address Change Email Notification RRS feed

  • General discussion

  • I downloaded the following script and am attempting to get it working:

    I've been looking for something like this to use, but I am not an expert and could use a little help.  This seems so simple, but Murphy just loves me too much to let this work.  I modified the following lines in the .ps1 file to read:

    $smtpServer = ""
    $sender = ""
    $users = "", "";

    And then I added my email and password to the following line of the 'if' statement:

    $smtp.Credentials = New-Object System.Net.NetworkCredential("", "password");

    These are the only changes I have made.  All the data I entered is correct (with the proper password of course). When I attempt the 'Import Task' action in the Task Scheduler and point to the .xml file, I get the following error:

    The format of the task is not valid. The following error was reported: (2,8):version:1.4

    Can anyone help me understand what I am doing wrong and what could be causing this error?  I'm running Win 7 Pro SP1.  Please let me know if I have forgotten to include some useful information.  Thanks!

    Tuesday, June 17, 2014 10:35 PM

All replies

  • What xml file? You can create the task yourself. Use these options:

    Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    Add arguments (optional): -file C:\Scripts\yourscriptfile.ps1

    -- Bill Stewart [Bill_Stewart]

    Tuesday, June 17, 2014 11:21 PM
  • On the script page at the link above, it gives the instruction: "Please edit variables in PS1 file and import the schedule task XML file in the Task Scheduler."  Sorry for not being more clear.  I am a novice when it comes to writing code and script, but this sounds simple enough that I should be able to get it to work.  If the .xml file is not in the correct format, why do the instructions say to use this file to import the task?

    Thank you for your reply Bill.  While I'm sure there is a way to create this task manually, and your simple instructions should be sufficient, I am still unable to make it happen.  Apparently I don't know how to create a task either, even though I've done this before (10 years ago).  I'll keep playing with it and maybe the planets will align.

    If anyone knows a good tutorial, has experience with this script in particular, or understands me well enough to tell me what I've done wrong, I am very grateful for your assistance.

    Otherwise, it sounds like this is my next best solution:

    But I'd prefer to get this script working!
    Wednesday, June 18, 2014 12:13 AM
  • Ah. I see the author said he includes an XML file for your convenience.

    You can ask questions about the author's script on the Q&A tab. This isn't a support forum for that author's script.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, June 18, 2014 2:25 AM
  • There is nothing wrong with the XML or with the files.  If you actually read all of the instructions andfollow them exactly you will end up with a scheduled script.

    Here is my proof:

    PS C:\temp3\IPchangeNotification> schtasks /create /xml IPchangeNotification_scheduleTask.xml /tn mytesttask
    SUCCESS: The scheduled task "mytesttask" has successfully been created.
    PS C:\temp3\IPchangeNotification>

    Note that the XML loads successfully.  It will load on WS2008 and later with no issues.

    The key here is to read the instructions and follow them exactly step by step.

    The script is older and is an older style  It will work.  I would never do it this way as an event in the event log can send email when the address is acquired or you can use a WMI event to trigger when the address is acquired.

    This will work

    I recommend spending time learning more about Windows if you are going to try and use scripts.  When you have problems it is always a good idea to post you exact steps and complete errors.


    Wednesday, June 18, 2014 2:43 AM
  • I should also note that ISPs no longer change IPs on  dynamic clients.  Your IP is allocated to your MAC address and remains.  This is in part to detect bad users and to track your use and behavior.  My home IP hasn't changed in almost 5 years.

    All ISPs, cable and Telco, are not virtualizing all addresses.  You address is permanent and is moveable.  In the past as ISPs rearranged the network addresses would change anytime the network was reallocated.  ISPs now just virtualize the address and then route it independent of segment.  Only some small and older ISPs still use older methods.


    Wednesday, June 18, 2014 2:50 AM
  • thank you for your reply and expertise.  and thanks for the technical answer as to why my IP here hasn't changed in years.  I figured it was something to that effect.

    I also value and appreciate your suggestions of RTFM and learning more about Windows.  I acknowledge my 22 years of experience is not enough to successfully operate Windows, however my contention is that this is by design.

    Wednesday, June 18, 2014 4:08 AM
  • You can successfully operate windows with little or no technical knowledge of how Windows works.  Learning a technology is not the same as operating a system.

    I suspect you can operate a car but I am sure you do not know how to build one and you could not describe the technical processes that allow a car to work.

    Scripting requires a technical knowledge of Windows and Windows networking.  You cannot build scripts without these basic concepts and technologies. My suggestions are only offered assuming that you want to use Windows technically although I suspect you may have just wanted a fix for something and may not care why or how it works. If that is the case then good luck. You have the solution.


    Wednesday, June 18, 2014 4:17 AM