title: Start-Process to run a powershell script with switch parameters
body: <p>What would be code to run a PowerShell script that includes a few switch parameters to be passed along with it and report success or failure?</p>
  
  <pre><code>Script Name : Get-Process.ps1
  Switch Parameters :  -UseCached -RunReport -Silent
  </code></pre>
  
  <p>Normally I run it like</p>
  
  <pre><code>PS C:\DATA FOLDER\Javed Eqbal&gt; .\Get-Process.ps1 -UseCached -RunRepor -Silent
  </code></pre>
  
  <p>I have the below code, but how do I include switch parameters in it?</p>
  
  <pre><code>$Exitcode = (Start-Process powershell -argument '.\Get-Process.ps1' -Wait -PassThru).ExitCode
  if ($Exitcode = '0')
  {
      Write-Host "SUCCESS"
  }
  else
  {
      Write-Host "FAILURE"
  }
  </code></pre>