title: Running powershell script from CMD does not load module
body: <p>So i have fairly easy powershell script that contains following:</p>
  
  <pre><code>import-module activedirectory
  
  Get-ADUser -Filter *
  
  remove-module activedirectory
  </code></pre>
  
  <p>If i run it from powershell it runs OK, but when i try to call it from CMD nothing happens, it just opens powershell and thats it. I am using following command to run it:</p>
  
  <pre><code>powershell.exe -file "D:\test.ps1"
  </code></pre>
  
  <p>I noticed also following thing, 2 powershell.exe processes run after i execute this. If i exit from CMD from one powershell then i start seeing lists that this PS query should be returning. Is there a way to get this working since i am trying to run ps script as scheduled job. The crucial part here is import module when i run it over cmd which is not happening for some reason.</p>
  
  <p>It's powershell 2.0 running on Windows 2008R2. I tried this script on win 2012r2, works fine from CMD... Looks like ps 2.0 limitation?</p>