Install-HarborService
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.
Syntax
Section titled “Syntax”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]Description
Section titled “Description”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.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”Install-HarborService # loopback https service on 8787Example 2
Section titled “Example 2”Install-HarborService -AllowRemote -Hostname harbor.corp.local -CertThumbprint AB12...Parameters
Section titled “Parameters”-AllowRemote
Section titled “-AllowRemote”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-BreakGlassPassword
Section titled “-BreakGlassPassword”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
Security.SecureString |
No | 6 | No |
-BreakGlassUser
Section titled “-BreakGlassUser”The break-glass account to create when the console has no sign-in yet.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 5 | No |
-CertThumbprint
Section titled “-CertThumbprint”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 2 | No |
-ConfigProfile
Section titled “-ConfigProfile”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 4 | No |
-Confirm
Section titled “-Confirm”Asks for confirmation before the command changes anything.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
Aliases: cf.
-Hostname
Section titled “-Hostname”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String[] |
No | 3 | No |
Default: @().
-Https
Section titled “-Https”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
Boolean |
No | 1 | No |
Default: True.
-InstallPath
Section titled “-InstallPath”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 7 | No |
Default: (Join-Path $env:ProgramFiles 'Harbor').
-LegacyInstallPath
Section titled “-LegacyInstallPath”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.
-TaskName
Section titled “-TaskName”Not described in the module help.
| Type | Required | Position | Pipeline input |
|---|---|---|---|
String |
No | 9 | No |
Default: Harbor Onboard Web.
-TrustRoot
Section titled “-TrustRoot”Trust the generated leaf certificate machine-wide (asked first).
| Type | Required | Position | Pipeline input |
|---|---|---|---|
SwitchParameter |
No | Named | No |
-WhatIf
Section titled “-WhatIf”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).
See also
Section titled “See also”- All Harbor Onboard cmdlets
- In PowerShell:
Get-Help Install-HarborService -Full
Covers Harbor Onboard 0.59.0 / Harbor Health 0.22.0. On an older release? Upgrading and the release notes list what changed.
