# Code Snippet from aperturescience.su $ipfile = "%temp%\externalip.txt" $iponfile = (Get-Content $ipfile -ErrorAction SilentlyContinue) try { $externalip = Get-ExternalIP if ($externalip -eq $iponfile) { # # IP Addresses match, all is good # # We might want to do something here, if you were using my standard template, a line like: # send-email "IP Address has not changed" $true # would be a neat thing to add } else { # #IP Address do not match, something very bad may have happened! Do Something! # # We need to save the new ip address to the log file before we do anything else. $externalip | Out-File $ipfile # you could continue and do almost anything, if you were using my standard template, a line like: # send-email "IP Address has changed" $false # would be a neat thing to add } } catch { # # Error occured getting the external ip address # # We might want to do something here, if you were using my standard template, a line like: # send-email "Error getting ip address" $false # would be a neat thing to add } # Code Snippet from aperturescience.su