What an exciting past couple of weeks we had with VMworld announcements and contents. Now, we bring PowerCLI 12.1 release with some of the notable enhancements concerning vSphere.
We have now introduced new cmdlets for managing-
- vSphere Lifecycle Manager (vLCM)
- Cloud-Native Storage Volumes (CNS volumes)
- vSAN secure disk wipe
- vVOL Storage containers
- Workload Management Clusters
Also, we have enhanced our existing capabilities to support-
- Secure Encrypted Virtualization in New-VM and Set-VM cmdlets
- Content library- Support extended to allow uploading items from internet and datastore URLs
- Added support for Site Recovery Manager 8.3.1
- New features for VMware Cloud on AWS. Click here to know about the enhancement related to VMCOnAWS
And, there are plenty of improvements and bug fixes in our existing capabilities. Please check out the complete release notes here to know more details about what’s new with PowerCLI 12.1.
In this blog post, I am excited to demonstrate cmdlets related to managing vSphere Lifecycle Manager(vLCM). vLCM has been introduced with vSphere 7.0 and has generated a lot of interest among the vCommunity members. If you are new to the vLCM, I would recommend you check out this blog post.
Install/Update PowerCLI 12.1
Install
Execute below cmdlet to install the latest PowerCLI version.
1 |
Install-Module -Name ‘VMware.PowerCLI’ |
Update
Execute below cmdlet to update the latest PowerCLI version.
1 |
Update-Module -Name ‘VMware.PowerCLI’ |
Use-cases to manage vLCM via PowerCLI
There are three new cmdlets to manage vLCM and these are-
- Get-LcmImage
- Test-LcmClusterCompliance
- Test-LcmClusterHealth
Also, there are significant changes that have been made with cluster related cmdlets so that we can update vLCM related settings on a vSphere Cluster.
Let us see a few of the use cases in detail which demonstrate PowerCLI capabilities to manage vLCM.
Get-LcmImage
This cmdlet retrieves the vSphere Lifecycle Manager images available on a vCenter Server system. The cmdlet returns a set of vSphere Lifecycle Manager images that correspond to the provided filter criteria.
You can filter the LcmImages with an Image type (Baseline, VendorAddon, and Component), or you can also filter a specific version of a LcmImage.
Execute the below cmdlet to know more about Get-LcmImage.
1 |
Get-help Get-LcmImage -ShowWindow |
Create a New Cluster with vLCM enabled
You can now use the New-Cluster cmdlet to create a vSphere Cluster managed by a vLCM image. You can achieve this by specifying 2 additional parameters which are -BaseImage and -VendorAddon in order to create a vLCM cluster image. Please note that -Component parameter is not currently available and you can use Set-Cluster cmdlet to update your vLCM cluster image later on.
Ex. Below, PowerCLI cmdlets create a new vSphere Cluster named as ‘vLCM-Cluster’ and Manage the hosts within this cluster with a single vLCM image with 7.0 Update 1 ESXi.
1 2 |
$LcmImage= Get-LcmImage -Version "7.0 Update 1 - 16850804" New-Cluster -Location 'Lab' -Name 'vLCM-Cluster' -HAEnabled -DrsEnabled -BaseImage $LcmImage |
Enable vLCM on an existing cluster
Set-Cluster cmdlet allows you to specify -BaseImage , -VendorAddon , and -Component which allows you to update existing cluster and enables vLCM cluster Image.
Ex. Update the existing cluster to set a new vLCM image.
1 2 |
$UpdateLcmImage= Get-LcmImage -Version "7.0 Update 1 - 16850804" Get-Cluster -Name "Test-Cluster" |Set-Cluster -BaseImage $UpdatelcmImage |
Test-LcmClusterCompliance
This cmdlet tests cluster’s host’s compliance concerning its target state. You can test the specified cluster’s hosts for compliance with the cluster’s vSphere Lifecycle Manager desired state.
1 |
Get-Cluster -Name 'vLCM-Cluster'|Test-LcmClusterCompliance |
Remediate vSphere Cluster
Set-Cluster cmdlet now allows you to remediate the vSphere cluster against a vLCM desired image and ensure all the hosts are compliant with the vLCM desired image. This is done by specifying a new switch -Remediate
Ex.
In this example, ESXi hosts are running with ESXi 7.0, and cluster desired state is 7.0 update 1. The below cmdlet remediates a vSphere Cluster against any possible drift on ESXi hosts concerning a vLCM cluster image.
1 |
Get-Cluster -Name 'vLCM-Cluster' |Set-Cluster -Remediate -AcceptEULA -RunAsync |
List vLCM image details for all the vSphere Cluster
To report details of the vLCM cluster image, Use the below cmdlet. This example only shows the BaseImage version. You can modify this cmdlet to list VendorAddon and components details also on a vLCM enabled cluster.
1 |
Get-Cluster |Select name, @{n='BaseImageVersion';e={$_.BaseImage.Version}} |
To Conclude
Undoubtedly, PowerCLI is a proven platform to automate VMware infrastructure. Having vLCM capabilities delivered via PowerCLI allows you to automate the management aspects of vLCM and keep your infrastructure consistent with the vLCM cluster image.
More Information
vSphere 7 – Lifecycle Management
PowerCLI 12.1 – Product Release
New Capabilities in PowerCLI 12.1 for VMware Cloud on AWS