Repository navigation
service windows
Eric Busboom edited this page Sep 24, 2026
·
1 revision
The sc.exe commands install-service prints, the named pipe, and what is untested.
Not verified on real hardware. The Windows code (named-pipe local API, Service Control Manager integration,
%ProgramData%paths) is covered only by unit tests with fakes. Nobody has run it against a real micro:bit on Windows. Expect rough edges, and please record what you find.
py -3.12 -m venv C:\mbtools
C:\mbtools\Scripts\pip install "git+https://github.com/League-Microbit/mbtools.git"
C:\mbtools\Scripts\mbregistry install-serviceOn Windows, install-service writes no files. It prints these
commands, which you then run in an Administrator shell. The binPath=
is the interpreter that ran install-service:
sc.exe create mbregistry binPath= "C:\mbtools\Scripts\python.exe -m mbtools.registry.cli run --windows-service" start= auto DisplayName= "mbtools micro:bit registry daemon"
sc.exe failure mbregistry actions= restart/60000/restart/60000/restart/60000 reset= 86400
sc.exe start mbregistry-
sc.exeneeds the space after eachname=. -
failurerestarts the service up to three times, 60 s apart, and resets the failure count after a day. This is the Windows analogue of systemd'sRestart=on-failure. -
--windows-servicemakes the process register with the SCM (StartServiceCtrlDispatcher). Without it, the SCM kills the process with error 1053. Don't use this flag interactively.
| Service name |
mbregistry (runs as LocalSystem, auto-start) |
| Database | %ProgramData%\mbregistry\devices.db |
| Local API | named pipe \\.\pipe\mbregistry (clients use it automatically) |
| TCP ports | same as other platforms: 7440, 7442, 7443, 7444, 7445 |
sc.exe query mbregistry
sc.exe stop mbregistry
sc.exe start mbregistry
sc.exe delete mbregistryLogs: a service's stdout/stderr are not captured anywhere. To see
output, stop the service and run C:\mbtools\Scripts\mbregistry run in a
console.
New-NetFirewallRule -DisplayName "mbregistry TCP" -Direction Inbound -Protocol TCP -LocalPort 7440,7442,7443,7444,7445 -Action Allow
New-NetFirewallRule -DisplayName "mbregistry mDNS" -Direction Inbound -Protocol UDP -LocalPort 5353 -Action AllowSee Networking and peering for what each port does.
sc.exe stop mbregistry
C:\mbtools\Scripts\pip install --upgrade "git+https://github.com/League-Microbit/mbtools.git"
sc.exe start mbregistry