title: Maven works in cmd but not powershell
body: <p>I want to build with maven my java projects on TFS Build Server. TFS Build Definition use invokeprocess in workflow. invokeprocess able to run powershell script and command batch file.</p>
  
  <p>Maven build successed with "<code>mvn assembly:assembly -P prod</code>" command in windows command prompt. But does not success in powershell. (I connected to server with remote and executed on powershell ise) (either as a regular user or as an administrator)</p>
  
  <p>I installed Maven 3.1.1 and Java Dev Kit 6 update 45 on Windows 2012 Standart 64-bit machine.We use NTLM authentication and proxy. </p>
  
  <p>I defined following configuration:</p>
  
  <p>Environment settings:</p>
  
  <pre><code>JAVA_HOME     C:\Program Files\Java\jdk1.6.0_45
  
  M2            %M2_HOME%\bin
  
  M2_HOME       C:\Program Files\Apache Software Foundation\apache-maven-3.1.1
  </code></pre>
  
  <p>Path:</p>
  
  <pre><code>  %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;%TFSPowerToolDir%;%BPADir%;%M2%;%JAVA_HOME%\bin
  </code></pre>
  
  <p>maven settings.xml:</p>
  
  <pre><code>&lt;settings&gt;
  &lt;proxies&gt;
  &lt;proxy&gt;   
    &lt;active&gt;true&lt;/active&gt;
    &lt;protocol&gt;http&lt;/protocol&gt;
    &lt;host&gt;proxy.xxx.entp&lt;/host&gt;
    &lt;port&gt;8080&lt;/port&gt;
    &lt;username&gt;myuser&lt;/username&gt;
    &lt;password&gt;mypassword&lt;/password&gt;
    &lt;nonProxyHosts&gt;*.xxx.entp|localhost&lt;/nonProxyHosts&gt;
  &lt;/proxy&gt;
  &lt;/proxies&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>The following is my powershell script: </p>
  
  <pre><code># mvn clean install
  # mvn assembly:assembly –P prod
  Set-ExecutionPolicy Unrestricted -Force
  $mvnArgs1 ="mvn assembly:assembly –P prod -Dmaven.test.skip=true".replace('-P','`-P').replace('-D','`-D')
  Invoke-Expression $mvnArgs1
  </code></pre>
  
  <p>The following is the output in powershell:</p>
  
  <p><a href="http://www.imageupload.co.uk/image/EDY" rel="noreferrer">please click the image of output powershell</a></p>
  
  <p>how to maven works in powershell? Or any way? </p>