TFS Build: Run a Powershell script as administrator

时间秒杀一切 提交于 2020-07-20 08:41:23

问题


I created a build definition for our nightly build server. After building the project (a windows service), I need to execute a Powershell script to install and start the service. So I added a build step to run the specific Powershell script. Then I installed a TFS Build Agent & Visual Studio at the (soon to be) nightly build server. After running the build script I got an 'exit code 5' which seems to be related to missing administratior permissions. If I start the script as admin on the server manually, it works fine. The user, which is used by the agent, already got admin permissions.

Is there a way to execute the powershell script on the build server with a build agent / build definition with admin permissions?


回答1:


You just need to make sure your build service account (which can be a local account, a domain account, or Local Service in a workgroup) also got admin permission.



来源:https://stackoverflow.com/questions/38458899/tfs-build-run-a-powershell-script-as-administrator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!