Skip to content

Install-HarborService

Harbor OnboardWindows administratorGenerated from the codeDescribes Onboard 0.59.0

Installs Harbor as an unattended machine service: a Task Scheduler ONSTART task running the web server headless, with HTTPS bound via http.sys. Requires an elevated console.

Terminal window
Install-HarborService [[-Port] <int>] [[-Https] <bool>] [[-CertThumbprint] <string>] [[-Hostname] <string[]>] [[-ConfigProfile] <string>] [[-BreakGlassUser] <string>] [[-BreakGlassPassword] <securestring>] [[-InstallPath] <string>] [[-LegacyInstallPath] <string>] [[-TaskName] <string>] [-AllowRemote] [-TrustRoot] [-WhatIf] [-Confirm]

Why a scheduled task and not a Windows service: powershell.exe cannot perform the SCM handshake (sc.exe-created services fail with error 1053), and a compiled wrapper would break Harbor’s zero-dependency principle. An AtStartup task with restart-on-failure gives the same operational result with in-box tooling only.

The module CODE is deploy-copied to -InstallPath first (default %ProgramFiles%\Harbor, admin-only): a SYSTEM-context boot task cannot read a user’s OneDrive/profile folder, so running from the checkout is not an option. Code never lives in the data store (%ProgramData%\Harbor, writable by the store’s trusted accounts) – a planted file there would run as SYSTEM. The deploy is a MIRROR, ownership is reset to Administrators, and the launcher refuses foreign-owned code before importing it. An older install’s code in %ProgramData%\Harbor is moved out (its Logs / Register / local config come along) and removed from the store.

HTTPS: unattended servers default to TLS, set up by Initialize-HarborTls (Phase 3 s3): without -CertThumbprint a self-signed LEAF (SAN localhost + 127.0.0.1, plus the -Hostname names for -AllowRemote; non-exportable key in LocalMachine\My) is generated – or Harbor’s existing one reused – and bound in http.sys for this port AND Harbor Health’s (8788). -TrustRoot also trusts that leaf machine-wide so browsers on this machine show no warning; pass an internal-CA cert thumbprint for other clients.

SIGN-IN: the SYSTEM console has no visible window for the first-run setup code, so a console with no sign-in method gets its break-glass account HERE (typed into this elevated console; -BreakGlassUser names it) before the task is registered. The service account the SYSTEM host uses must have a secret SYSTEM can read: SecretManagement (a vault SYSTEM can open), or a DPAPI blob saved FROM the SYSTEM account (a blob saved by YOUR account is not readable by SYSTEM) – or connect: manual, connecting from the console with the secret typed in. Never a machine-wide environment variable: every local user and process can read those.

Terminal window
Install-HarborService # loopback https service on 8787
Terminal window
Install-HarborService -AllowRemote -Hostname harbor.corp.local -CertThumbprint AB12...

Not described in the module help.

Type Required Position Pipeline input
SwitchParameter No Named No

Not described in the module help.

Type Required Position Pipeline input
Security.SecureString No 6 No

The break-glass account to create when the console has no sign-in yet.

Type Required Position Pipeline input
String No 5 No

Not described in the module help.

Type Required Position Pipeline input
String No 2 No

Not described in the module help.

Type Required Position Pipeline input
String No 4 No

Asks for confirmation before the command changes anything.

Type Required Position Pipeline input
SwitchParameter No Named No

Aliases: cf.

Not described in the module help.

Type Required Position Pipeline input
String[] No 3 No

Default: @().

Not described in the module help.

Type Required Position Pipeline input
Boolean No 1 No

Default: True.

Not described in the module help.

Type Required Position Pipeline input
String No 7 No

Default: (Join-Path $env:ProgramFiles 'Harbor').

Where 0.54-and-earlier deployed the code (migrated + cleaned on re-install).

Type Required Position Pipeline input
String No 8 No

Default: C:\ProgramData\Harbor.

Not described in the module help.

Type Required Position Pipeline input
Int32 No 0 No

Default: 8787.

Not described in the module help.

Type Required Position Pipeline input
String No 9 No

Default: Harbor Onboard Web.

Trust the generated leaf certificate machine-wide (asked first).

Type Required Position Pipeline input
SwitchParameter No Named No

Shows what the command would do, without doing it.

Type Required Position Pipeline input
SwitchParameter No Named No

Aliases: wi.

This command also accepts the PowerShell common parameters (-Verbose, -ErrorAction, and so on).

Covers Harbor Onboard 0.59.0 / Harbor Health 0.22.0. On an older release? Upgrading and the release notes list what changed.