6

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?

4
  • You can't bypass the UAC prompt, if that's what you are asking. Commented Jul 19, 2016 at 14:41
  • Our admins configured the server to disable UAC, so this should not be the problem Commented Jul 20, 2016 at 10:19
  • This is unfortunate. Disabling UAC is definitely not recommended. Commented Jul 20, 2016 at 14:08
  • 1
    Is there another way to get along with UAC when executing PowerShell scripts (that require admin permissions) in TFS build definitions? Commented Jul 21, 2016 at 8:10

1 Answer 1

9

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.

Sign up to request clarification or add additional context in comments.

2 Comments

The user configured for the build agent already got full admin permissions, yet i still get error code 5 problems when executing the powershell script
Okay, problem solved... The machine had to be restartet after the permission change (i should have known it better after 20 years as a Windows user)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.