Set-VIMachineCertificate

This cmdlet sets a machine SSL certificate to a vCenter Server instance or a connected ESXi host.By default, the certificate is set to the vCenter Server instance. If you want to set the certificate to a specific ESXi host, you must use the VMHost parameter.The result from the command is the updated vCenter Server or ESXi entity with the certificate that was set.To use this cmdlet, you must connect to vCenter Server through the Connect-VIServer cmdlet.

Syntax

[-Key  <AsymmetricAlgorithm>]
[-PemCertificate  <String>]
[-PemKey  <String>]
[-Server  <VIServer>]
[-X509Certificate  <X509Certificate>]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
optional
Key
AsymmetricAlgorithm named Specifies the private key as AsymmetricAlgorithm type of the certificate that you want to set. Note: To use this parameter, you must have PowerShell version 7.1 or later.
optional
PemCertificate
String named Specifies a certificate in PEM format to be set as the machine SSL certificate to a vCenter Server instance or an ESXi host.
optional
PemKey
String named Specifies the private key in PEM format of the certificate that you want to set to a vCenter Server system.
optional
Server
VIServer named
optional
X509Certificate
X509Certificate named Specifies a certificate as an X509Certificate object to be set as the machine SSL certificate to a vCenter Server instance or an ESXi host.

-VMHost  <VMHost>
[-PemCertificate  <String>]
[-Server  <VIServer>]
[-X509Certificate  <X509Certificate>]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VMHost
VMHost named
  • pipeline
  • Specifies the ESXi host to which you want to set a machine SSL certificate.
    optional
    PemCertificate
    String named Specifies a certificate in PEM format to be set as the machine SSL certificate to a vCenter Server instance or an ESXi host.
    optional
    Server
    VIServer named
    optional
    X509Certificate
    X509Certificate named Specifies a certificate as an X509Certificate object to be set as the machine SSL certificate to a vCenter Server instance or an ESXi host.

    Output

    ViMachineCertificateInfo

    Examples


    Example 1

    $certificatePem = Get-Content cert.pem -Raw
    Set-VIMachineCertificate -PemCertificate $certificatePem

    Sets the certificate from the cert.pem file to the vCenter Server system.

    Example 2

    $certificatePem = Get-Content cert.pem -Raw
    Set-VIMachineCertificate -PemCertificate $certificatePem -VMHost 'MyHost'

    Sets the certificate from the cert.pem file to the 'MyHost' ESXi host.

    Related Commands

    Feedback

    Was this page helpful?