title: Powershell, start or stop iis site using msdeploy
body: <p>I was trying to migrate my batch script to powershell.</p>
  
  <p>I have tried writing the script and run it from powershell ise.</p>
  
  <pre><code>$sites = @("abc","xyz","pqr")
  foreach ($site in $sites)
  {
      msdeploy -verb:sync -verbose -source:runcommand -dest:runcommand="$env:windir\system32\inetsrv\appcmd stop site /site.name":$site
  }
  </code></pre>
  
  <p>When I run the command(msdeploy) it runs perfect from command prompt.</p>
  
  <p>I get the following error (attached):</p>
  
  <p><a href="https://i.stack.imgur.com/s6J9N.png" rel="nofollow noreferrer">Error capture</a></p>
  
  <p>I would appreciate if someone can help me on this. Thanks in advance.</p>