Add-VITrustedCertificate
This cmdlet adds a certificate or certificate chain to the vCenter Server or ESXi trusted stores.To use this cmdlet, you must connect to vCenter Server through the Connect-VIServer cmdlet.Note: The certificate or certificate chain will be added to both the vCenter Server instance and the connected ESXi hosts unless you use the VCenterOnly or EsxOnly parameters.
Syntax
Parameters
| Required | Parameter Name | Type | Position | Features | Description | 
|---|---|---|---|---|---|
| optional | PemCertificateOrChain | String[] | named | 
                                 | 
                            Specifies a certificate or certificate chain in PEM format to be added to the vCenter Server and/or ESXi trusted stores. | 
| optional | ProgressAction | ActionPreference | named | 
                                 | 
                            |
| optional | Server | VIServer[] | named | 
                                 | 
                            Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | 
| optional | VMHost | VMHost[] | named | 
                                
  | 
                            Specifies one or more ESXi hosts to whose trusted stores you want to add the certificate or certificate chain. | 
| optional | X509Certificate | X509Certificate2[] | named | 
                                 | 
                            Specifies a certificate as an X509Certificate object to be added to the vCenter Server and/or ESXi trusted stores. | 
| optional | X509Chain | X509Chain[] | named | 
                                 | 
                            Specifies a certificate chain as an X509Chain object to be added to the vCenter Server and/or ESXi trusted stores. | 
Parameters
| Required | Parameter Name | Type | Position | Features | Description | 
|---|---|---|---|---|---|
|                                  required 
                                 | 
                            EsxOnly | SwitchParameter | named | 
                                 | 
                            Specifies that the certificate or certificate chain must be added only to the trusted store of the ESXi hosts. | 
| optional | PemCertificateOrChain | String[] | named | 
                                 | 
                            Specifies a certificate or certificate chain in PEM format to be added to the vCenter Server and/or ESXi trusted stores. | 
| optional | ProgressAction | ActionPreference | named | 
                                 | 
                            |
| optional | Server | VIServer[] | named | 
                                 | 
                            Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | 
| optional | X509Certificate | X509Certificate2[] | named | 
                                 | 
                            Specifies a certificate as an X509Certificate object to be added to the vCenter Server and/or ESXi trusted stores. | 
| optional | X509Chain | X509Chain[] | named | 
                                 | 
                            Specifies a certificate chain as an X509Chain object to be added to the vCenter Server and/or ESXi trusted stores. | 
Parameters
| Required | Parameter Name | Type | Position | Features | Description | 
|---|---|---|---|---|---|
|                                  required 
                                 | 
                            VCenterOnly | SwitchParameter | named | 
                                 | 
                            Specifies that the certificate or certificate chain must be added only to the trusted store of the vCenter Server instance. | 
| optional | PemCertificateOrChain | String[] | named | 
                                 | 
                            Specifies a certificate or certificate chain in PEM format to be added to the vCenter Server and/or ESXi trusted stores. | 
| optional | ProgressAction | ActionPreference | named | 
                                 | 
                            |
| optional | Server | VIServer[] | named | 
                                 | 
                            Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | 
| optional | X509Certificate | X509Certificate2[] | named | 
                                 | 
                            Specifies a certificate as an X509Certificate object to be added to the vCenter Server and/or ESXi trusted stores. | 
| optional | X509Chain | X509Chain[] | named | 
                                 | 
                            Specifies a certificate chain as an X509Chain object to be added to the vCenter Server and/or ESXi trusted stores. | 
Output
VMware.VimAutomation.ViCore.Types.V1.Certificates.TrustedCertificateInfoExamples
Example 1
$caPem = Get-Content ca.pem -Raw Add-VITrustedCertificate -PemCertificateOrChain $caPem
Adds the certificate from ca.pem to the trusted certificate stores of the vCenter Server and all the ESXi hosts connected to the vCenter system.
Example 2
$caPem = Get-Content ca.pem -Raw Add-VITrustedCertificate -PemCertificateOrChain $caPem -VCenterOnly
Adds the certificate from ca.pem to the trusted certificate store of the vCenter Server system.
Example 3
$caPem = Get-Content ca.pem -Raw Add-VITrustedCertificate -PemCertificateOrChain $caPem -EsxOnly
Adds the certificate from ca.pem to the trusted certificate stores of the ESXi hosts of the vCenter Server system, but not to the vCenter itself.
Example 4
$caPem = Get-Content ca.pem -Raw Add-VITrustedCertificate -VMHost 'MyHost' -PemCertificateOrChain $caPem
Adds the certificate from ca.pem to the trusted certificate store of the 'MyHost' ESXi host.
Related Commands
VITrustedCertificate
This cmdlet adds a certificate or certificate chain to the vCenter Server or ESXi trusted stores.
This cmdlet retrieves information about the trusted certificates in a vCenter Server environment.
This cmdlet removes one or more certificates or certificate chains from the vCenter Server or ESXi trusted stores.