Elevated PS script in Jenkins
<p>I have been trying to run a script from a Windows Jenkins (slave) server. The script is written in PowerShell and requires elevated privileges (such as if one right-clicked on PS and selected run-as-administrator). </p>

<p>Jenkins launches its scripts the following way:</p>

<pre><code>powershell.exe -NonInteractive -ExecutionPolicy ByPass "&amp; 'C:\Users\JOHAN.DER\AppData\Local\Temp\2\hudson9084956499652818911.ps1'" 
</code></pre>

<p>My script fails because it requires elevated privileges. How can I spawn a new elevated-privileged PS process (that does not require clicking because Jenkins can't do that) that could run my script?</p>

<p>Cheers! </p>