Update vCenter-SSL.ps1

This commit is contained in:
2025-11-19 23:07:34 -06:00
parent b409a95133
commit 5279ad8de8

View File

@@ -50,9 +50,9 @@ function Show-Failure {
$msg = $ErrorRecord.Exception.Message $msg = $ErrorRecord.Exception.Message
Write-Log ERROR $msg Red Write-Log ERROR $msg Red
Write-Host "======================================================" Red Write-Host "======================================================" -ForegroundColor Red
Write-Host "ERROR: $msg" Red Write-Host "ERROR: $msg" -ForegroundColor Red
Write-Host "======================================================" Red Write-Host "======================================================" -ForegroundColor Red
exit 1 exit 1
} }
@@ -93,9 +93,9 @@ try {
Write-Log INFO "Connecting to vCenter $VCENTERHOST..." Write-Log INFO "Connecting to vCenter $VCENTERHOST..."
Connect-VIServer -Server $VCENTERHOST -User $VCENTERUSER -Password $VCENTERPASS -Force | Out-Null Connect-VIServer -Server $VCENTERHOST -User $VCENTERUSER -Password $VCENTERPASS -Force | Out-Null
Write-Host "========================================" Write-Host "========================================" -ForegroundColor Green
Write-Host "SUCCESS: Connected to vCenter." Write-Host "SUCCESS: Connected to vCenter." -ForegroundColor Green
Write-Host "========================================" Write-Host "========================================" -ForegroundColor Green
} catch { Show-Failure $_ } } catch { Show-Failure $_ }
# ---------------------------- # ----------------------------
@@ -256,9 +256,9 @@ if ($needNewCert) {
try { try {
Set-VIMachineCertificate -PemCertificate $leafPem -PemKey $keyPem -Confirm:$false | Out-Null Set-VIMachineCertificate -PemCertificate $leafPem -PemKey $keyPem -Confirm:$false | Out-Null
Write-Host "===========================================================" Write-Host "===========================================================" -ForegroundColor Green
Write-Host "SUCCESS: vCenter Machine SSL certificate updated." ForegroundColor Green Write-Host "SUCCESS: vCenter Machine SSL certificate updated." ForegroundColor Green
Write-Host "===========================================================" Write-Host "===========================================================" -ForegroundColor Green
Write-Log INFO "Certificate updated successfully." Write-Log INFO "Certificate updated successfully."