title: Create PowerShell script to send an email if files are older than 30 minutes
body: <p>I need to run a script against automatically created and purged files in a directory.</p>
  
  <p>I used the script from here:
  <a href="http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26895555.html" rel="nofollow">http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26895555.html</a></p>
  
  <p>The problem with this script is it sends the email regardless of whether it finds any offending files or not.</p>
  
  <p>Also it detects the old file and sends an email but when it's time to check again it doesn't report the file again.</p>
  
  <p>I would like to run this as a scheduled task (which I know how to do) but I want it to only send the email if it finds offending files and I want it to report the offenders every time it checks.</p>
  
  <p>Thanks for any help.</p>