VMware Cloud Community
Sridharan13
Contributor
Contributor
Jump to solution

Refresh CA Certificates on Host using PowerCli

Hi,

I need to refresh ca certs in host after I publish my certs. The below command is not working. It works only when I manually refresh it from the UI. I need to automate this using powercli. So kind suggest if there is any way. 


/usr/lib/vmware-vmafd/bin/vecs-cli force-refresh

Labels (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

$si = Get-View ServiceInstance
$certMgr = Get-View -Id $si.Content.CertificateManager

Get-VMHost | ForEach-Object -Process {
  $certMgr.CertMgrRefreshCACertificatesAndCRLs($_.Id)
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

4 Replies
mrtgokul
Contributor
Contributor
Jump to solution

You can take a look at the PowerCLI function at the below Site which might be helpful for your requirement.

https://vmwarecode.com/2020/07/11/renew-esxi-vmca-certificate/ 

Reply
0 Kudos
Sridharan13
Contributor
Contributor
Jump to solution

that is for Renew. I need for Refresh (Refresh CA certificates) 

Tags (1)
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this

$si = Get-View ServiceInstance
$certMgr = Get-View -Id $si.Content.CertificateManager

Get-VMHost | ForEach-Object -Process {
  $certMgr.CertMgrRefreshCACertificatesAndCRLs($_.Id)
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Sridharan13
Contributor
Contributor
Jump to solution

Thanks a lot.. it worked..
For future reference
https://kb.vmware.com/s/article/80461

Tags (1)
Reply
0 Kudos