TFS Build: run Powershell script as administrator

I created a build definition for our nightly build server. After creating the project (Windows service), I need to run a Powershell script to install and start the service. Therefore, I added a build step to run a specific version of the Powershell script. Then I installed the TFS build agent and Visual Studio on the (soon to come) nightly build server. After starting the build script, I got exit code 5, which seems to be related to the missing administrator rights. If I run the script as an administrator on the server manually, it works fine. The user used by the agent has already received administrator permissions.

Is there a way to execute a powershell script on an assembly server with an assembly / assembly definition with administrator privileges?

+5
source share
1 answer

You just need to make sure that your build service account (which can be a local account, a domain account, or a local service in a workgroup) has also received administrator permission.

+5
source

All Articles