Update vCenter-SSL.ps1

This commit is contained in:
2025-11-15 19:53:52 -06:00
parent 6a9a96caf2
commit 6bc7835728

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env pwsh
# -----------------------------------------------------------------------------------
# vCenter + Posh-ACME Script using PowerCLI (TLS-safe, cross-platform)
# vCenter + Posh-ACME Script using PowerCLI (TLS-safe, ACME fixed)
# -----------------------------------------------------------------------------------
. /opt/idssys/nodemgmt/conf/powerwall/settings.ps1
@@ -77,7 +77,7 @@ Import-Module Posh-ACME -ErrorAction Stop
# ----------------------------
$pArgs = @{
PowerDNSApiHost = $WDNSHOST
PowerDNSApiKey = $PDNSAPI
PowerDNSApiKey = $PDNSAPI # Plain string, do NOT convert to SecureString
PowerDNSUseTLS = $true
PowerDNSPort = 443
PowerDNSServerName = 'localhost'
@@ -143,12 +143,13 @@ if ($certSuccess) {
}
# ----------------------------
# Restart vpxd service
# Restart vpxd service via PowerCLI (safe)
# ----------------------------
try {
$uriRestart = "https://$VCENTERHOST/rest/appliance/system/services/vpxd?action=restart"
Invoke-RestMethod -Uri $uriRestart -Method Post -Headers $sessionHeaders -SkipCertificateCheck
Write-Host "vCenter vpxd service restart requested." -ForegroundColor Yellow
Write-Host "Restarting vpxd service..." -ForegroundColor Yellow
$service = Get-VMHostService -VMHost $VCENTERHOST | Where-Object { $_.Key -eq "vpxd" }
if ($service) { Restart-VMHostService -HostService $service -Confirm:$false }
Write-Host "vpxd service restart requested." -ForegroundColor Yellow
} catch {
Write-Host "Failed to restart vpxd service: $($_.Exception.Message)" -ForegroundColor Yellow
$global:helpme = $_.Exception.Message