Skip to content

HostPrep.ps1 v4.3.0: prompt for NTP servers instead of silently defaulting to pool.ntp.org - #7

Merged
pauldiee merged 3 commits into
mainfrom
issue-6-prompt-ntp-servers
Jul 14, 2026
Merged

pauldiee merged 3 commits into
mainfrom
issue-6-prompt-ntp-servers

Conversation

@pauldiee

Copy link
Copy Markdown
Owner

Closes #6.

What changed

When -NtpServers is not supplied on the command line, the script now confirms the NTP server(s) interactively before any host is touched:

NTP servers...
  Default if you press Enter: pool.ntp.org
  Enter NTP server(s), comma separated [Enter = default]:

Pressing Enter still applies pool.ntp.org — the point is that it becomes a deliberate choice rather than a silent parameter default. Passing -NtpServers behaves exactly as before and never prompts, so unattended runs are unaffected.

The prompt sits after the host list is loaded and before credential gathering, so the operator sees which time source is about to be pushed before typing the root password.

Reported by a customer: on the isolated management networks these hosts usually sit on, pool.ntp.org is unreachable, so the silent default left every host with a configured-but-dead time source — which then resurfaces later as confusing certificate and SDDC Manager commissioning failures.

Also in this PR

  • README: stale SSH auth description corrected. The requirements section still described the pre-4.1.0 scheme (throwaway ed25519 keypair pushed over the HTTPS /host/ssh_root_authorized_keys endpoint). ESXi 9 removed that endpoint; since v4.1.0 the script authenticates with the root password via ssh.exe's SSH_ASKPASS helper. The script's own .NOTES header was already correct — only the README had drifted. (Replace Posh-SSH with the built-in Windows OpenSSH client #3)
  • Version bumped to 4.3.0 in both the .NOTES header and $ScriptMeta; changelog and -NtpServers parameter help updated.

Testing

Not yet run against a live ESXi host.

The NTP block itself was exercised in isolation with a real param binding:

Input Prompted? Resulting servers
-NtpServers ntp1.corp.local,ntp2.corp.local no ntp1.corp.local, ntp2.corp.local
(prompt) Enter / empty yes pool.ntp.org
(prompt) whitespace only yes pool.ntp.org
(prompt) ntp1.vcf.lab yes ntp1.vcf.lab
(prompt) "ntp1.vcf.lab" , ntp2.vcf.lab , yes ntp1.vcf.lab, ntp2.vcf.lab

Quotes, stray spaces and trailing commas are stripped; empty input falls back to the default rather than clearing the list.

🤖 Generated with Claude Code

pauldiee and others added 3 commits July 14, 2026 13:59
…lting

When -NtpServers is not supplied on the command line, confirm the NTP
server(s) interactively before any host is touched, offering pool.ntp.org
as the default that Enter accepts. Passing -NtpServers still runs
unattended with no prompt.

The public pool is unreachable on the isolated management networks these
hosts usually sit on, so silently applying it left every host with a dead
time source -- which then surfaces later as confusing certificate and
commissioning failures. Reported by a customer. (GitHub issue #6)

README and parameter help updated; version bumped in both the .NOTES
header and $ScriptMeta.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The requirements section still described the pre-4.1.0 scheme -- a
throwaway ed25519 keypair pushed to each host over the HTTPS
/host/ssh_root_authorized_keys endpoint. ESXi 9 removed that endpoint;
since v4.1.0 the script authenticates with the root password via
ssh.exe's SSH_ASKPASS helper. Brings the README in line with the script's
own .NOTES header. (GitHub issue #3)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Without PowerCLI the script printed a wall of "not recognized" errors for
every PowerCLI cmdlet, then carried on and prompted for the host list, the
NTP servers and the root password before finally dying at Connect-VIServer.

Check for VMware.VimAutomation.Core at the top of Initialisation -- ahead
of the Get-PowerCLIConfiguration calls that error first -- and exit with
the install command. Also notes that PowerCLI must be installed for the
same PowerShell edition the script runs under, since a 5.1 install is
invisible to PowerShell 7.

Found while testing the NTP prompt on a machine without PowerCLI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pauldiee
pauldiee merged commit d55ece2 into main Jul 14, 2026
1 check passed
@pauldiee
pauldiee deleted the issue-6-prompt-ntp-servers branch July 14, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NTP: silently defaults to pool.ntp.org when -NtpServers is not supplied

1 participant