From 3180d4ea75cbea2c62fcb0742eb1b6d4bed91ec2 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Wed, 4 Nov 2026 11:53:41 +0100 Subject: [PATCH] fix(Update-KHDB): actually accept -MaxParallelTransfers The README documents `.\Update-KHDB.ps1 -MaxParallelTransfers 8`, but the script had no param() block: -MaxParallelTransfers landed in $args, Update-KHDB was called with no arguments, and PowerShell 7 always used the function's default of 5 concurrent transfers. The relaunch forwarded it as an unbound argument, with the same result. The script now declares the parameter (same 1-64 range as the function) and passes $PSBoundParameters through. Verified against a local HTTP server standing in for an S3-compatible endpoint: before, -MaxParallelTransfers 1 still logged "up to 5 concurrent transfer(s)"; after, 1 downloads serially, 4 runs the parallel path, and 99 is rejected by ValidateRange. --- CHANGELOG.md | 1 + Update-KHDB.ps1 | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e41a833..f1accea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Starting with **v2.2.0**, Elysium uses a **unified project version**. All script - `Test-WeakADPasswords.ps1` did not relaunch under Windows PowerShell like `Extract-NTHashes.ps1` does, so a direct run under `pwsh` loaded DSInternals through `-UseWindowsPowerShell` implicit remoting, which returns deserialized objects. It also set the PSGallery repository to `Trusted` on the host as a side effect of installing DSInternals; that is removed (`-Force` on the install already covers the prompt). - `Update-LithnetStore.ps1` ignored `InstallationPath`/`WeakPasswordsDatabase` and always looked for `khdb.txt` next to the script; it now resolves the same KHDB path as the other scripts. It also writes a transcript to `Reports/logs/` like the other operational scripts and uses the shared settings parser instead of its own copy. - The `Restart-WithPwshIfAvailable` / `Restart-WithWindowsPowerShellIfAvailable` relaunchers in `Elysium.Common.ps1` relaunched `Elysium.Common.ps1` itself instead of the calling script (`$PSCommandPath` inside a function is the file that defines it), then exited. Whenever a relaunch fired, the script silently did nothing: `Update-KHDB.ps1`, `Prepare-KHDBStorage.ps1`, `Update-LithnetStore.ps1` and `Uninstall.ps1` started from Windows PowerShell on a host with `pwsh` installed (including menu options 1, 4 and 5), and `Extract-NTHashes.ps1` / `Test-WeakADPasswords.ps1` started directly from `pwsh`. They now relaunch the calling script with its parameters. +- `Update-KHDB.ps1 -MaxParallelTransfers N`, as documented in the README, was silently ignored: the script had no `param()` block, so the value never reached the downloader and PowerShell 7 always used 5 concurrent transfers. The script now declares and forwards the parameter (values outside 1-64 are rejected). ## [2.4.6] — 2026-07-29 diff --git a/Update-KHDB.ps1 b/Update-KHDB.ps1 index c72950d..297d096 100644 --- a/Update-KHDB.ps1 +++ b/Update-KHDB.ps1 @@ -18,8 +18,17 @@ Known-hashes database updater for the Elysium AD password testing tool. Downloads a sharded KHDB manifest, performs incremental shard updates, validates checksums, and atomically refreshes the merged khdb.txt for downstream scripts. Supports Azure Blob Storage (via SAS) and S3-compatible endpoints (SigV4). + +.PARAMETER MaxParallelTransfers +Concurrent shard downloads on PowerShell 7+ (default 5). #> +[CmdletBinding()] +param( + [ValidateRange(1, 64)] + [int]$MaxParallelTransfers = 5 +) + $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest @@ -798,5 +807,5 @@ function Update-KHDB { } } -Update-KHDB +Update-KHDB @PSBoundParameters Write-Host "Script execution completed."