Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Start and restart Windows self-hosted runner automatically


I've successfully set up a self-hosted runner on a Windows Server 2019 VM. How would you set it up so that it starts on boot and restarts on failure?


2 answers

1 accepted

Ok, this is what I did. Assuming we have the agent in d:\bb...


Download for windows: from:

Then copy these files (I use the x64 version):
Copy-Item amd64/prunsrv.exe d:\bb\bin\
Copy-Item prunmgr.exe d:\bb\bin\
New-Item -ItemType Directory -Path d:\bb\logs

Create an install.ps1 file in d:\bb\bin
param (
    [string]$accountUuid = $(throw "-accountUuid is required."),
    [string]$repositoryUuid = "",
    [string]$runnerUuid = $(throw "-runnerUuid is required."),
    [string]$OAuthClientId = $(throw "-OAuthClientId is required."),
    [string]$OAuthClientSecret = $(throw "-OAuthClientSecret is required."),
    [string]$workingDirectory = $(throw "-workingDirectory is required."),
    [string]$serviceUser = $(throw "-serviceUser is required."),
    [string]$servicePassword = $(throw "-servicePassword is required."),
    [string]$runnerEnvironment = "PRODUCTION",
    [string]$scheduledStateUpdateInitialDelaySeconds = "0",    
    [string]$scheduledStateUpdatePeriodSeconds = "30",
    [string]$cleanupPreviousFolders = "false",
    [string]$logPath = "../logs"

(-not (Get-Command -name "java" -CommandType Application -errorAction SilentlyContinue))
    Write-Error "Java not installed"

$argList = @("install",
            '--DisplayName="Bitbucket Runner"',
            '--Description="Bitbucket Runner Service"',

= @{
    FilePath = "prunsrv"
    ArgumentList = $argList

$p = Start-Process @params -NoNewWindow -Wait

Create uninstall.ps1 in D:\bb\bin
$argList = @("delete",

$params = @{
    FilePath = "prunsrv"
    ArgumentList = $argList

$p = Start-Process @params -NoNewWindow -Wait

CD into D:\bb\bin and run
.\install.ps1 -accountUuid '{*****}' -runnerUuid '{*****}' -OAuthClientId ***** -OAuthClientSecret ***** -workingDirectory '..\temp' -serviceUser DOMAIN\user -servicePassword ***

I can't get my service to start after following this installation procedure. procmon requires an Oracle JDK properly installed in the registry but Bitbucket runner only works with OpenJDK. How did you do it? Thanks.

I used the Eclipse Adoptium Java version and then

1. Added this JAVA_HOME to environment variables: 

C:\Program Files\Eclipse Adoptium\jdk-


2. Added to PATH: 

C:\Program Files\Eclipse Adoptium\jdk-\bin

Like sebastien_ezfocus likes this

Thank you very much!

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 11, 2022

Hi @fernando_arias ,

welcome to the Atlassian community!

You need to install a service. Please take a look to the following article

Hope this helps,


Thanks, Fabio

Looks like the answer is for running Bitbucket as a service, but I'm talking about a Bitbucket Windows runner.

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events