# Windows workstations (hcs)

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> On Windows, Ringleader runs each workstation as a virtual machine of its own through hcs, with its own Linux kernel and memory.


On Windows, Ringleader runs each workstation as a virtual machine of its own through hcs, with
its own Linux kernel and memory. hcs uses Windows' Host Compute Service, and the Ringleader
application labels an hcs workstation **HCS VM**. When hcs can run on your PC, it is the default
local provider, and a workstation that names no provider runs on it.

## hcs requirements

hcs needs two things from your PC:

- The Windows feature Virtual Machine Platform turned on. Hyper-V also works if it is already
  on. [Turn on Virtual Machine Platform](https://docs-stg.ringleader.dev/install/#turn-on-virtual-machine-platform)
  has the steps. Ringleader has tested hcs only on Windows 11 Pro.
- The Ringleader VM Service, which the installer adds and starts. If it is stopped or missing,
  open **Programs and Features** in Control Panel, right-click **Ringleader** and choose
  **Repair**.

Creating a workstation needs no administrator rights and no membership in the Hyper-V
Administrators group, because the Ringleader VM Service does that work.
[Review what gets installed](https://docs-stg.ringleader.dev/install/#review-what-gets-installed) says whose
account it acts for.

`rl status` lists hcs and marks it as the default, or says why your PC can't run it. If hcs
can't run, your PC has no default local provider, as
[Default local provider](https://docs-stg.ringleader.dev/workstations/basics/#default-local-provider)
describes.

## Workstation size on Windows

A workstation that sets no size gets one from your PC, such as all of its CPUs and a quarter of
its memory. The
[hcs keys](https://docs-stg.ringleader.dev/reference/providers/images-keys/#hcs-local-windows) in the Providers reference
give each default.

When you change `cpus`, `memory` or `disk` on an existing workstation, Ringleader stops it,
applies the new size and starts it again. A disk can grow but never shrink. If you set a
smaller `disk`, Ringleader refuses the change, and the workstation reports the field it can't
change. A workstation that sets no size keeps the one it was created with, even when your PC's
defaults change.

## Limits for each Windows account

The Ringleader VM Service holds each Windows account to these limits, which are fixed for now:

- At most 32 workstations, stopped ones included.
- For each workstation, at most all of your PC's CPUs and three quarters of its memory.
- For all of the account's running workstations together, at most three quarters of your PC's
  memory. Three workstations of the default size fit in that on a PC with at least 8 GiB. A
  workstation that would go over it doesn't start until you stop another one.
- For everything the account's workstations store, at most half the size of the drive that
  holds `%ProgramData%`. That limit is never below 64 GiB or above 1 TiB. Each disk counts at its
  full size, even while most of it is empty. The base disks described below count too.

If a request goes over a limit, the service refuses it, and the workstation's status says which
limit it hit.

## Base disks on Windows

Each workstation's disk is layered on a base disk, which the Ringleader VM Service builds once
for each image your Windows account uses. A base disk stays after you delete the last
workstation that uses it, so the next workstation of that image starts without building it
again.

An account can keep at most 8 base disks. A new workstation, a larger disk or another base disk
can need the room. The service then deletes the base disks nothing uses, least recently used
first, until the request fits. If deleting all of them wouldn't be enough, it deletes none and refuses
the request.

## Names and addresses a Windows workstation reaches

Each hcs workstation has a network process on your PC that carries its traffic. The workstation
reaches the internet and the other computers on your network, over IPv4 only. It looks up a
host name's IPv4 address through Windows' own resolver, the one your PC's programs use.

An hcs workstation doesn't reach your PC. The network process refuses its connections to your
PC's own `127.0.0.1` and its other addresses, and to link-local addresses, such as a cloud's
metadata address. Nothing on your network can connect to an hcs workstation.

Each workstation's SSH listens on a Windows loopback port that Ringleader picks, and you can't
choose it. If something else takes that port, Ringleader moves the workstation to another one
and records an `SSHPortMoved` event.

## Egress policy without an Edge on Windows

An hcs workstation enforces an egress policy and injects a credential with no Edge, as
[Network processes and edge VMs](https://docs-stg.ringleader.dev/security/outbound/enforcement/#network-processes-and-edge-vms)
says. Its network process adds credentials where a rule's `allowDaemonPlacement` gate permits
it, checks an Integration host marked `inspect: true`, and records refusals and credential use
on your PC. A `strict` or `audit` policy is accepted when you apply the workstation. One created
before hcs gave each workstation its own address reports `NoEdge`, as [Enforcement by provider](https://docs-stg.ringleader.dev/security/outbound/enforcement/#enforcement-by-provider) says.

## Workstations when you sign out of Windows

When you sign out of your last Windows session, Ringleader stops your hcs workstations, and
whatever runs inside them stops too. Each one starts again once you have signed back in and the
Ringleader daemon is running. The Ringleader application starts the daemon at sign-in when its
**Launch at login** setting is on. Otherwise, the workstations stay stopped until you run
`rl daemon start` or open the application.

When a workstation starts again after a sign-out, its events carry a `StoppedAtSignOut` warning.
The warning gives the time of the sign-out and names `keepRunningAfterSignOut`. Run
`rl workstation describe` with the workstation's name to read the events.

A workstation with `keepRunningAfterSignOut: true` carries on with whatever runs inside it
after you sign out. It reaches nothing after you sign out, and you can't connect to it. Its
network process runs in your Windows session and ends with it. A workstation under an egress
policy stays restricted the whole time.

<div class="callout callout-warning">
  <p class="callout-title">It shares your PC with the next account</p>
  <div class="callout-body">
    A workstation that keeps running holds its memory while you are away. Another account that
signs in shares your PC with it.
  </div>
</div>


When you sign in again, the Ringleader daemon starts each network process again once it is
running itself. With **Launch at login** on, the workstations that kept running are usually
reachable again within a few minutes of sign-in. Until the daemon runs, `rl get` shows each workstation as it was before you
signed out. If a workstation's status then says another program holds its port, stop and start the workstation to give it a new one.

## Workstations when your PC sleeps

When your PC sleeps, its hcs workstations pause, and they carry on when it wakes, with their
clocks set to the right time. Locking the screen or switching to another Windows account changes
nothing for them.

## Size a workstation on Windows

To size a workstation, set `cpus`, `memory` in GiB and `disk` in GiB under `providerConfig`,
then apply the file:

```yaml
apiVersion: workstations.ringleader.dev/v1
kind: Workstation
metadata:
  name: my-pc-box
  namespace: local
spec:
  provider: hcs
  providerConfig:
    cpus: 4
    memory: 8
    disk: 60
```

## Keep a workstation running after you sign out

To keep a workstation running through a sign-out, set `keepRunningAfterSignOut` and apply the
file:

```yaml
spec:
  provider: hcs
  providerConfig:
    keepRunningAfterSignOut: true
```

Changing the value on a running workstation doesn't restart it.

## Reach a service on your PC

To let a workstation reach a service on your PC, such as a local model server, add the
service's port to a [LocalBinding](https://docs-stg.ringleader.dev/reference/resources/localbinding/)'s `reversePorts`.
The workstation then reaches it at its own `127.0.0.1`.

## Free the space base disks use

To see your base disks, run `rl image list`. To delete one now, run `rl image delete` with its
name. `rl image delete --unused` deletes every image nothing uses, downloaded images included.
[Cached images](https://docs-stg.ringleader.dev/reference/cli/commands/images/) describes both commands.

## Diagnose an hcs workstation that doesn't start

If an hcs workstation doesn't start, follow these steps:

1. Run `rl status`. It says whether your PC can run hcs, and why not.
2. Run `rl troubleshoot my-pc-box --diagnostics`, with your workstation's name. The
   [diagnostics bundle](https://docs-stg.ringleader.dev/troubleshooting/#prepare-a-diagnostics-bundle) then holds
   `hcs-host-logs.txt`, with the workstation's network log and its console output from the
   current and the previous start.
3. If the Ringleader VM Service doesn't start, open the Windows Application event log and look
   under the source RingleaderVM for the reason.

The service's own log is `%ProgramData%\RingleaderVM\service.log`, and only an elevated
program can read it.

## Next steps

- [Provider images and keys](https://docs-stg.ringleader.dev/reference/providers/images-keys/#hcs-local-windows) lists hcs's images and
  `providerConfig` keys.
- [Local container runtime](https://docs-stg.ringleader.dev/reference/local-container-runtime/)
  covers the Linux virtual machine your `docker` command talks to.
- [Uninstall Ringleader](https://docs-stg.ringleader.dev/guides/uninstall-ringleader/) covers what happens to
  your hcs workstations' disks when you remove Ringleader.

