Skip to content

Register-HarborHealthSchedule

Harbor HealthNo sign-in neededGenerated from the codeDescribes Health 0.22.0

Registers the Windows Task Scheduler job that runs the health scan on a cadence (G1 pattern): daily at a set time by default, or every N hours. Runs as the CURRENT user without storing a password (S4U), so it fires whether or not anyone is signed in.

Terminal window
Register-HarborHealthSchedule [[-At] <string>] [[-EveryHours] <int>] [[-ConfigProfile] <string>] [[-TaskName] <string>] [-WhatIf] [-Confirm]

The task invokes the repo’s Invoke-HarborHealthScan.ps1 runner with powershell.exe -NonInteractive (a prompt can never hang it). Each run connects with the profile’s DECLARED service account (its serviceAccount block: Set-HarborServiceAccount, or Harbor Home -> Settings -> Tenant & service account), reading only the declared secret source, as the Windows account the task runs as. So declare a source that account can read with no prompt: ‘dpapi’ stored by that same account, a ‘secretManagement’ vault it can open unattended, or ‘env’ with the variable set in that account’s USER scope (never machine-wide). A ‘prompt’ account cannot run unattended: the task fails fast – check Get-HarborHealthSchedule.LastResult. Re-running replaces the existing task (idempotent).

Terminal window
Register-HarborHealthSchedule -ConfigProfile prod
Terminal window
Register-HarborHealthSchedule -ConfigProfile prod -EveryHours 6

Daily run time, 24h ‘HH:mm’ (default 06:00). Ignored when -EveryHours is set.

Type Required Position Pipeline input
String No 0 No

Default: 06:00.

Not described in the module help.

Type Required Position Pipeline input
String No 2 No

Asks for confirmation before the command changes anything.

Type Required Position Pipeline input
SwitchParameter No Named No

Aliases: cf.

Run every N hours instead of daily (1-24). First run starts at the next -At time today/tomorrow, then repeats.

Type Required Position Pipeline input
Int32 No 1 No

Default: 0.

Not described in the module help.

Type Required Position Pipeline input
String No 3 No

Default: Harbor Health Scan.

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.