Release

New Release – VMware PowerCLI 12.2

The VMware PowerCLI 12.2 is released now. It brings plenty of improvements to the existing cmdlets and introduces new cmdlets.

Please find the release highlights here-

  1. Horizon
    • VMware Horizon PowerCLI module is now supported for macOS and the Linux OS
  2. VMC
    • We’ve added support for one of the most popular VMware Cloud Services – DRaaS. Using the new cmdlets customers can now enable/disable DRaaS on their VMC SDDC as well as add and remove SRM instances.
  3. vSphere
    • Extended support for vLCM
      • New cmdlets to export and import the cluster desired state
      • New cmdlets to get the vLCM recommendations
      • New cmdlets to get the vLCM hardware compatibility
      • Enhanced Set-Cluster to allow custom depot for ROBO environments
    • Extended the support ‘ovf’ parameters for the content library item
    • Added support for VM templates in the content library
    • Foreach-object -Parallel is now supported
  4. Workload Management
    • New cmdlets to manage namespace limits
  5. NSX-T
    • NSX-T global manager APIs are now supported

In this blog post, I will discuss some of these improvements in detail.

VMware Horizon – Compatible with macOS and Linux

There was a requirement for a long time to make VMware Horizon compatible with PowerShell core. The good news is, it is now compatible with PowerShell core to work with macOS, Linux, or any other platform of your choice.

‘DRaaS’ Support for VMC

New cmdlets have been introduced to support the DRaaS management. The new cmdlets allow you to activate ‘Site recovery’ on a specified SDDC and help you manage Site recovery instances.

Activate Site Recovery on an SDDC

The Set-VmcSddc has got a new parameter called -EnableSiteRecovery, which allows you to activate site recovery on a specific SDDC. Check out below PowerCLI snippet and a short demo.

Check out the Set-VmcSddc cmdlet reference to know more.

 

Manage Site recovery Instances

A new set of cmdlets are introduced to manage the Site recovery instances. Once site recovery is enabled, you can manage the instances via the below cmdlets.

Get-VmcSddcSiteRecoveryInstance

New-VmcSddcSiteRecoveryInstance

Remove-VmcSddcSiteRecoveryInstance

Extended Support for vLCM

We have introduced the vSphere Lifecycle Manager (vLCM) cmdlets starting from PowerCLI 12.1. With the release of PowerCLI 12.2, we are now further extending the vLCM cmdlet coverage. Let’s look at some of these operations in detail.

Export Cluster Desired state

A new cmdlet Export-LCMClusterDesiredState is introduced to export a cluster desired state. Do check out the cmdlet reference to learn more.

Export-LCMClusterDesiredState

Ex.

Import Cluster Desired Image

A new cmdlet Import-LCMClusterDesiredState is introduced to import a cluster desired state. Do check out the cmdlet reference to learn more.

Import-LCMClusterDesiredState

Ex.

Get vLCM Recommendations

A new cmdlet is introduced to provide the desired state recommendation if any new base image is available to use.

Check out the details here.

Get-LcmClusterDesiredStateRecommendation

Override custom depot

We have added an additional parameter –DepotOverrides <String[]> to the Set-Cluster cmdlet, which allows you to define a custom image depot to be used by vLCM.

Extended PowerCLI support for content library items

Please find the details of enhancements we are introducing with PowerCLI 12.2 concerning the content library item.

OVF Parameters on a Content Library Item

A new parameter  -ContentLibraryItem is added on Get-OvfConfiguration cmdlet. It will allow you to fetch and update the ovf parameters from a content library item.

Example:


 

Specify OvfConfiguration

New OVFConfiguration parameter has been added to the New-VM cmdlet to allow specifying OVF parameters when deploying OVF template from the content library


 

Deploy VMs from VM Templates Stored in a Content Library

New-VM cmdlet is now capable of deploying VMs from VM templates in a content library


 

Foreach-Object -parallel {} is now supported

PowerShell team introduced a new switch -Parallel to foreach-object cmdlet starting from PowerShell v7. The new switch allowed PowerShell to execute parallel jobs on a collection of objects, thus reducing overall execution time. However, Foreach-Object -parallel wasn’t supported with VMware PowerCLI until now.

When you use Foreach-Object -parallel, PowerShell creates child runspaces to execute the respective jobs. The problem PowerCLI had was that it couldn’t reuse the VISessions within the child runspace hence failing to execute the PowerCLI cmdlets.

Happy to inform you all that foreach-object -Parallel is now supported with PowerCLI. This can be achieved by 2 ways.

Inline -Server parameter

You will require to store VISession in a variable and pass the connection variable to each PowerCLI cmdlet under foreach-object -parallel.

Let’s take a look at the below example.

Use PowerCLI Context

You can execute and store the Get-PowerCLIContext cmdlet to a variable, which will store the VISession variables and Imported modules from the parent runspace. You can then use the PowerCLI context within the foreach-object -parallel to pass the VISession information to child run space. This method eliminates the need to specify inline -Server parameter to each PowerCLI cmdlet.

Let’s take a look at the below example.

Manage Namespace Limits via PowerCLI

Two new cmdlets have been introduced to manage the workload cluster namespace limits.

Check out below cmdlets references to know more.

Get-WMNamespaceLimits
Set-WMNamespaceLimits

Concluding this, I recommend you to visit the PowerCLI 12.2 release notes to know more about improvements and bugfixes. Also, Do check out the PowerCLI home page for anything and everything related to PowerCLI.

 

Comments

3 comments have been added so far

  1. Is Foreach-Object -parallel {} supported on CI cmdlets as well? Or just VI ones? This would be a huge deal if it allowed for the simultaneous import of multiple VMs into vCloud.

  2. Hi Jatin, I think I have found a bug in the Linux installation of PowerCLI 12.2.
    When I install the module as root, even using the -Scope AllUsers parameter, the VMware.PowerCLI module is put into the system shared modules at /usr/local/share/powershell/Share however, all of the remining modules are stored in the root user’s local modules directory at /root/.local/share/powershell/Modules.

    This means that a non-root user cannot use PowerCLI without copying the modules either into that user’s local modules, or into the system shared location.

    I have installed on Ubuntu, PowerCLI version 12.2.17538434 from PSGallery

    If this is expected behavior, please let me know the proper way to support using PowerCLI as a non-root user 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *