title: How to remote execute an ELEVATED remote script in PowerShell
body: <p>I have two servers:</p>
  
  <ul>
  <li><strong>serverA</strong> (windows 2003 server)</li>
  <li><strong>serverB</strong> (windows 7)</li>
  </ul>
  
  <p><strong>ServerA</strong> contains a folder with a batch file (deploy.bat) that needs to be executed from an elevated powershell prompt. In <strong>ServerA</strong>, if I run it from a normal prompt or powershell prompt it fails. If I run it from an elevated prompt it works. (run as administrator).</p>
  
  <p>The problem I have is when I try to execute batch file from <strong>serverB</strong> using a remote powershell execution. I am able to execute with this command:</p>
  
  <pre><code>Invoke-Command -computername serverA .\remotedeploy.ps1
  </code></pre>
  
  <p>The content of  <strong>remotedeploy.ps1</strong> is:</p>
  
  <pre><code>cd D:\Builds\build5
  .\Deploy.bat
  </code></pre>
  
  <p>I have looked a lot questions in stackoverflow about:</p>
  
  <ul>
  <li>Execute a remote powershell (This works for me)</li>
  <li>Execute a local powershell with elevated prompt (I can do it)</li>
  </ul>
  
  <p>This question is about both at the same time. So the exact question is:</p>
  
  <p><strong>Is possible to execute an ELEVATED REMOTE script in PowerShell?</strong></p>