简体   繁体   English

TFS Build:以管理员身份运行Powershell脚本

[英]TFS Build: Run a Powershell script as administrator

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. 在构建项目(Windows服务)之后,我需要执行Powershell脚本来安装和启动服务。 So I added a build step to run the specific Powershell script. 所以我添加了一个构建步骤来运行特定的Powershell脚本。 Then I installed a TFS Build Agent & Visual Studio at the (soon to be) nightly build server. 然后我在(即将成为)每晚构建服务器上安装了TFS Build Agent和Visual Studio。 After running the build script I got an 'exit code 5' which seems to be related to missing administratior permissions. 运行构建脚本后,我得到了一个“退出代码5”,这似乎与缺少管理员权限有关。 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? 有没有办法在构建服务器上使用具有管理员权限的构建代理/构建定义执行powershell脚本?

您只需确保您的构建服务帐户(可以是本地帐户,域帐户或工作组中的本地服务)也获得管理员权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM