Hi there,
I got this little Script, I want to automate the certification renewal.
$vcenter = $global:DefaultVIServer.name
$csrParams = @{
Country="DE"
Email="someemail"
Locality="moon"
Organization="marsians"
OrganizationUnit="xxx"
StateOrProvince="xxx"
CommonName=$vcenter
}
$csr = New-VIMachineCertificateSigningRequest @csrParams
$csr.CertificateRequestPEM | Out-File $d\vc.cert.pem -Force
$vcCert = Get-Content $d\vc.cert.pem -Raw
Add-VITrustedCertificate -PemCertificateOrChain $vcCert -vcenteronly -WhatIf
Set-VIMachineCertificate -PemCertificate $vcCert -WhatIf
My problem, I get following error Message after
Add-VITrustedCertificate -PemCertificateOrChain $vcCert -vcenteronly -WhatIf
Error:
Write-Error: C:\Program Files\WindowsPowerShell\Modules\VMware.PowerCLI.VCenter\12.6.0.19600125\commands\Add-VITrustedCertificate.ps1:210:13
Line |
210 | Write-PowerCLIError `
| ~~~~~~~~~~~~~~~~~~~~~
| No certificate found in the PemCertificateOrChain.
I already tried it without Whatif, same error.
The pem file is right already opened it in notepad++, why can't I load the pem file into the command?
Hope anybody can help me.
Thanks in advance
regards
Susie
You seem to have the WhatIf switch on the Add-VITrustedCertificate cmdlet, meaning nothing is added.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
even without the Whatif switch I get the same error.
regards
Susie
Hi all,
just playing with different certs, the problem is the pem file I am generating. so I have to find a way to generate a working one.
regards
Susie