June 12, 2024

More vSAN Cmdlets in PowerCLI 11!

There’s a new release of PowerCLI, and it includes some more vSAN goodness!

We’ve added some capabilities previously found in the Ruby vSphere Console and have also updated a couple of the existing modules

PowerCLI 11


The new and updated cmdlets include:

  • Get-VsanObject makes it easy to get information about a vSAN Object or a VM’s vSAN Objects. This cmdlet returns much of the same information as the vsan.vm_object_info and vsan.obj_status_report scripts in the RVC. Objects can be returned based on the VM they belong to, the type of vSAN Object, which vSAN Disk they reside on, the cluster/server they reside on, or their specific Id.
    PowerCLI 11
  • Get-VsanComponent returns information about the different components that make up a vSAN Object. The vsan.disk_object_info script returns this information but only returns components on a specific vSAN Disk. This cmdlet can enumerate components based on their Id, per host, or specific vSAN Disk it resides on.
    PowerCLI 11
  • Get-VsanEvacuationPlan provides visibility of the impact of a host, disk group, or device were to be put into maintenance mode or were to go offline. This also shows how much data has to move to maintain storage policy compliance, or to ensure accessibility to one or more vSAN Objects.
    PowerCLI 11
  • Get-VsanDisk was introduced in an earlier release of PowerCLI, additional properties including Capacity and Percent of Capacity Used.
    PowerCLI 11
  • Get-VsanStat has been enhanced to allow for predetermined time range as well as a time range that is longer than 24 hours. Predetermined time ranges include Last5Minutes, Last15Minutes, LastHour, and more.
    PowerCLI 11


Administrators who have previously looked for vSAN information in the RVC, now have much of the same information at their fingertips using PowerCLI. More detailed vSAN information can be retrieved programmatically with PowerCLI, which can be used for management, orchestration, and other related tasks.

While the PowerCLI cmdlets don’t necessarily provide the same output as some of the RVC scripts, it is entirely possible to report in a similar fashion. Here is a sample output of the vsan.vm_object_info RVC script for a the RDC1 VM:

PowerCLI 11

Creating a PowerShell Function, the same can be accomplished easily:

PowerCLI 11

Here’s a copy of that function: https://code.vmware.com/samples/4710

By providing these new and updated cmdlets, many of the same capabilities (previously reserved to the Ruby vSphere Console or other custom code) are now easy accomplish using PowerCLI. Administrators don’t have to log into an RVC console, move up and down the vSAN object structure, and execute scripts. Many of these can be accomplished easily and securely from an authenticated PowerCLI session.

By bringing this information into PowerCLI, and effectively PowerShell, even more possibilities open up as PowerShell scripts interact with independent systems and applications.

Each new release of PowerCLI continues to provide vSphere Administrators, and vSAN Administrators in this case, more extensibility, flexibility, and possibilities to easily deploy, manage, and maintain vSphere (and vSAN) environments of any scale.

This was originally posted to the VMware Virtual Blocks site: https://blogs.vmware.com/virtualblocks/2018/10/11/more-vsan-cmdlets-in-powercli-11/

2 thoughts on “More vSAN Cmdlets in PowerCLI 11!

  1. Hi Jase.

    I hope you are doing good. I have one doubt. I am looking for powershell/python command sets to enable remote datastore(Vsan HCI Mesh ) and mount remote vsan datastore in the cluster.

    Please let me know if any powershell/python reference to do using cli.


    1. Muthu,
      Unfortunately, I don’t work on the vSAN product anymore, and don’t have access to a vSAN cluster to even attempt to address your question.
      The only guidance I could provide, would be to use the vCenter Code Capture capability to attempt to reveal the code necessary to accomplish the task.
      Keep in mind that if the code is not available in a public API, Code Capture will not return any results.

      Good luck!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.