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