I have a .ps1 file which needs to be run in administrative mode for it to work. But unfortunately I couldn't find a way to do that using Jenkins. Currently I am running this powershell command in execute batch command on Jenkins with all possible options. But it's not working.
Easy hack to solve this was indeed adding a .bat file that was run from the Jenkins(Execute windows batch command). The bat file had following command which did run the powershell script with elevated(admin) rights
powershell -ExecutionPolicy Unrestricted -File your_script.ps1 --settings_skipverification=true
Execute it with Invoke-Command via Jenkins.
Invoke-command -FilePath Script.ps1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With