# Install USB Relay on Windows

> Install the Bitfocus USB Relay desktop app on Windows, or run USB Relay as a Windows service instead.

USB Relay lets a Stream Deck plugged into a Windows PC show up in Buttons as a network surface, even though it isn't physically attached to the machine running Buttons. Once running, Buttons discovers it and any Stream Deck attached to it, and you adopt them the same way as any other surface.

The installer offers two ways to run it. **Desktop app** is selected by default: that is [Bitfocus USB Relay](/docs/buttons/v1.10/integrations/usb-relay/desktop), with a system tray icon. **Headless Windows service** runs it in the background instead. Do not run both at once. Both use port **3040**.

## Before you begin

- The Windows PC has any Stream Deck hardware you want to relay plugged in.
- Network connectivity between this PC and your Buttons installation.
- A Buttons license above the free tier: adopting a USB Relay surface requires at least an Individual-tier license.

## Install

1. Download the Windows installer and run it. The installer needs administrator rights.
2. Accept the license agreement.
3. On the components page, leave **Desktop app** selected. Its description is "The Bitfocus USB Relay app, with a system tray icon".
4. Select **Headless Windows service** only when you want a background service instead of the app. Its description says not to run both at once.
5. Leave **Add Firewall Rules** selected.
6. Select **Install**. When only the desktop app was installed, the finish page can **Start Bitfocus USB Relay**.

A Start menu shortcut named **Bitfocus USB Relay** opens the app. How to use the window is covered in [Use the USB Relay desktop app](/docs/buttons/v1.10/integrations/usb-relay/desktop).

<callout color="gray" title="Note">
  Upgrading a PC that already has the Windows service keeps **Headless Windows service** selected, and leaves **Desktop app** unselected unless the app was already installed.
</callout>

### Switch from the Windows service to the desktop app

If this PC already runs USB Relay as a Windows service, stop and remove the service before you start the app. The service keeps port **3040**, and until it stops, the app shows **Connection error**.

1. Open a Command Prompt as administrator in the USB Relay install folder, then run:

```
bitfocus-buttons-usb-relay-headless.exe stop-service
bitfocus-buttons-usb-relay-headless.exe uninstall-service
```

   Or, in `services.msc`, stop **Bitfocus Buttons USB-Relay** and set its startup type to **Disabled**.

2. Run the installer and select **Desktop app**. Clear **Headless Windows service**.
3. Start **Bitfocus USB Relay** from the Start menu.

## Run the Windows service

If you selected **Headless Windows service**, it is already running. No further action needed.

By default the service runs in **server mode**: it listens on port **3040** and announces itself on the network so Buttons can find it automatically. No further configuration is needed for this.

## Discover and adopt it in Buttons

Once running, open Buttons and follow the normal discovery flow: see [Add and attach a surface](/docs/buttons/v1.10/surfaces/add-and-attach-a-surface). The relay itself appears in the discovered list labeled **USB Relay**; adopting it also makes any Stream Deck attached to that PC available to adopt, either from the relay's own settings or back in the main Surfaces list.

## Manage the service

- **Check or change startup behavior:** open `services.msc` (press `Win+R`, type `services.msc`), find **Bitfocus Buttons USB-Relay**, and use its Properties to change the startup type or start/stop it manually.
- **Reinstall or remove just the service registration:** `bitfocus-buttons-usb-relay-headless.exe` accepts `install-service`, `uninstall-service`, `start-service`, `stop-service`, and `status-service`. These manage the Windows service without reinstalling the whole application. Reinstalling the service this way is safe to repeat; it replaces any existing registration rather than failing. The desktop app does not take these commands.
- **Fully remove USB Relay:** use Windows' own **Add or remove programs**.

## Connect outbound to a specific Buttons address

If your network doesn't support automatic discovery, the desktop app does this in **Client** mode. See [Use the USB Relay desktop app](/docs/buttons/v1.10/integrations/usb-relay/desktop#choose-server-or-client).

For the Windows service, add `-buttonsAddress <ip>:<port>` by reinstalling the service with that flag included.

<callout color="gray" title="Note">
  There's no separate flag to change the relay's own listening port; it only changes via an environment variable (`USB_RELAY2_PORT`) if you genuinely need something other than the default.
</callout>

## If Buttons' certificate changes

If you replace Buttons' own HTTPS certificate (see [Replace the HTTPS certificate](/docs/buttons/v1.10/administration/certificates)) while a relay is already connected outbound to it, the relay notices the certificate no longer matches what it trusted before and refuses to reconnect, to protect against a silently swapped server. In the desktop app, select **Forget** under **Server certificate**, then let it connect again. For the Windows service, add `-accept-cert-change` once so it trusts and remembers the new certificate.

## If you get stuck

| What you see | What to try |
| --- | --- |
| The relay doesn't appear in Buttons' discovered surfaces. | For the desktop app, confirm the banner says **Listening**. For the service, check `services.msc`. Both machines need a network that supports discovery. |
| The relay reports that it cannot multicast. | The relay can't broadcast itself on the network, usually due to a Public network profile, VPN, or a corporate network that blocks discovery traffic. Skip discovery and connect outbound: see [Connect outbound to a specific Buttons address](#connect-outbound-to-a-specific-buttons-address) above. |
| You need it to connect outbound instead of waiting to be discovered. | In the desktop app, choose **Client** and save the Buttons address. For the service, reinstall it with `-buttonsAddress <ip>:<port>`. |
| The relay refuses to reconnect after you replaced Buttons' HTTPS certificate. | In the desktop app, select **Forget** under **Server certificate**. For the service, run it once with `-accept-cert-change` if the change was intentional. |
| You want to change which port the relay listens on. | Set the `USB_RELAY2_PORT` environment variable: there's no command-line flag for this. |

## Where to go next

- [Use the USB Relay desktop app](/docs/buttons/v1.10/integrations/usb-relay/desktop)
- [Add and attach a surface](/docs/buttons/v1.10/surfaces/add-and-attach-a-surface)
- [Manage your Buttons license](/docs/buttons/v1.10/getting-started/license-buttons)
