Update vCenter-SSL.ps1

This commit is contained in:
2025-11-19 22:18:01 -06:00
parent 1210b1f668
commit ff2dedaf11

View File

@@ -65,7 +65,7 @@ try {
Install-Module VCF.PowerCLI -Force -Scope AllUsers -AllowClobber
}
Import-Module VCF.PowerCLI -ErrorAction Stop -Verbose:$false
Import-Module VCF.PowerCLI -ErrorAction Stop | Out-Null
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false `
-ParticipateInCEIP:$false -DisplayDeprecationWarnings:$false | Out-Null
@@ -76,7 +76,7 @@ try {
if (-not (Get-Module -ListAvailable -Name Posh-ACME)) {
Install-Module Posh-ACME -Force -Scope AllUsers
}
Import-Module Posh-ACME -ErrorAction Stop -Verbose:$false
Import-Module Posh-ACME -ErrorAction Stop | Out-Null
Write-Log INFO "Posh-ACME loaded."
} catch { Show-Failure $_ }
@@ -180,28 +180,28 @@ if (-not $paCert) {
exit 1
}
# ----------------------------
# Certificate file resolution
# ----------------------------
$certFolder = Split-Path $paCert.CertFile -Parent
$certPath = Join-Path $certFolder "cert.cer"
$keyPath = Join-Path $certFolder "cert.key"
$chainPath = Join-Path $certFolder "chain.cer"
Write-Log INFO "Using cert folder: $certFolder"
Write-Log INFO " CERT : $certPath"
Write-Log INFO " KEY : $keyPath"
Write-Log INFO " CHAIN: $chainPath"
foreach ($f in @($certPath,$keyPath,$chainPath)) {
if (-not (Test-Path $f)) {
Write-Log ERROR "Missing cert file: $f"
exit 1
}
}
if ($needNewCert) {
# # ----------------------------
# # Certificate file resolution
# # ----------------------------
# $certFolder = Split-Path $paCert.CertFile -Parent
#
# $certPath = Join-Path $certFolder "cert.cer"
# $keyPath = Join-Path $certFolder "cert.key"
# $chainPath = Join-Path $certFolder "chain.cer"
#
# Write-Log INFO "Using cert folder: $certFolder"
# Write-Log INFO " CERT : $certPath"
# Write-Log INFO " KEY : $keyPath"
# Write-Log INFO " CHAIN: $chainPath"
#
# foreach ($f in @($certPath,$keyPath,$chainPath)) {
# if (-not (Test-Path $f)) {
# Write-Log ERROR "Missing cert file: $f"
# exit 1
# }
# }
# ----------------------------
# Add CA chain to trusted store (remove duplicates)
# ----------------------------