title: Cmdlet Runs Much Faster in ISE than Console
body: <p>I have developed a Powershell Cmdlet, and a script that drives it. I have found that the functionality of the Cmdlet runs very quickly in Powershell ISE, and also via a wrapper EXE called from the command line (say 2 minutes). However if I call the script in CMD via <code>powershell.exe -File</code> the same operation takes 6-7 minutes.</p>
  
  <p>The script basically loads some DLLs via <code>System.Reflection.Assembly.LoadFile</code>, loads a type full of configuration info via <code>Add-Type</code>, then calls the custom Cmdlet (once- not in a loop). The Cmdlet functionality involves lots of database access, network storage access, and processing. I cannot post source code of any kind.</p>
  
  <p>I have found that in both ISE and the command line, the ApartmentState is STA and the Host version (Major, Minor, Build, Revision) is (3, 0, -1, -1).</p>
  
  <p>My question is: what further checks are available to identify the reason for this difference in execution time?</p>