VIMachineCertificate Category | Vmware PowerCLI Reference

VI Machine Certificate Category

Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations

Step 1: Retrieve a object by running a Get command

You can READ objects by using Get-VIMachineCertificate cmdlet. See example below:

# Retrieve the machine certificate of the vCenter Server system and its ESXi hosts.

Get-VIMachineCertificate

Step 2 : Run commands from the CRUD group

You can CREATE objects by using New-VIMachineCertificateSigningRequest cmdlet. See example below:

# Creates a CSR for the vCenter Server instance and saves it in the 'csr' variable. You can get the certificate request in PEM format by evaluating $csr.CertificateRequestPEM.

$csr = New-VIMachineCertificateSigningRequest ` -Country 'US' ` -Email '[email protected]' ` -Locality 'Example Town' ` -Organization 'Example organization' ` -OrganizationUnit 'Example organization unit' ` -StateOrProvince 'Example state'
You can UPDATE objects by using Set-VIMachineCertificate cmdlet. See example below:

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

$certificatePem = Get-Content cert.pem -Raw PS C:\> Set-VIMachineCertificate -PemCertificate $certificatePem