title: My PowerShell script only works when running from ISE
body: <p>I can't post all of the script contenet, but the basic idea is that it downloads JSON and converts it to objects using the <code>ConvertFrom-Json</code> cmdlet. Some objects are filtered out, and the rest are written to an XML/XLS document (in the Excel 2003 format). This file is then attached to an email and sent to various people.</p>
  
  <p>The problem I'm having is that it only works when run from the Powershell ISE. Once I try setting up a scheduled task, calling it from cmd, or even calling it from powershell, the attached file is completely empty. It is as if some functions do not run (the one that loops through and creates all rows).</p>
  
  <p>I can continue to run from ISE for the time being, but the idea of this script is to send out an automatic email that will require no intervention. Any ideas as to what could be causing this?</p>