title: Powershell Script to run Unit Test using MSTest.exe
body: <p>How to run all the unit test in a solution directory using Powershell Script.
  I tried with the below command </p>
  
  <pre><code>$tool = '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe"'
  
  $x = ""; dir D:\DropBuildOutput\*.Tests.dll -Recurse | foreach { $x += "/testcontainer:""$_"" " }; iex "$tool $x"
  </code></pre>
  
  <p>But its failing with error below.How can i run all the tests and generate results?</p>
  
  <pre><code>iex : At line:1 char:79
  + ...  (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcont ...
  +                                                                  ~
  You must provide a value expression following the '/' operator.
  At line:1 char:79
  + ... STest.exe" /testcontainer:"D:\DropBuildOutput\_PublishedWebsites\SCJ. ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Unexpected token 
  'testcontainer:"D:\DropBuildOutput\_PublishedWebsites\aaa.aaa.aaa.aaa\bin\xxx.aaa.aaa.Tests.dll"' in 
  expression or statement.
  At line:2 char:100
  + ... -Recurse | foreach { $x += "/testcontainer:""$_"" " }; iex "$tool $x"
  +                                                            ~~~~~~~~~~~~~~
      + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
      + FullyQualifiedErrorId : ExpectedValueExpression,Microsoft.PowerShell.Commands.InvokeExpressionCommand
  </code></pre>