title: Powershell script not recognizing my function
body: <p>I have a powershell script that parses a file and send an email if it detects a certain pattern. I have the email code setup inside a function, and it all works fine when I run it from the ISE, but I used <strong>PS2EXE</strong> to be able to run the script as a service but it does not recognize the function "email". my code looks similar to this</p>
  
  <pre><code>#Do things | 
  foreach{
      email($_)
  }
  
  function email($text){
      #email $text
  }
  </code></pre>
  
  <p>When I convert it to exe and run it I get this error:</p>
  
  <pre><code>The term 'email' is not recognized as teh name of a cmdlet, function, script file, 
  or operable program. Check the spelling of the name, or if a path was included, 
  verify that the path is correct and try again.
  </code></pre>