Hyperconverged Infrastructure Software-Defined Storage vSAN vSphere Storage

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.

Comments

9 comments have been added so far

  1. Does the new Get-VsanComponent cmdlet only work with vSAN 6.7?

    I’m running vSAN 6.6 and getting no data when running the examples given for Get-VsanComponent.

    Other cmdlet examples, like Get-VsanObject and Get-VsanEvacuationPlan work.

    Thanks!

  2. Hey kmcd,

    A couple users have indicated they did have to restart their ISE for the new cmdlets to work properly. You could potentially need to update the backend PowerShell build you’re using.

    Give our GSS folks a call, and they should be able to help you resolve the issue.

  3. I have one vCenter managing two vSAN clusters. I’ve discovered if I run Get-VsanObject and pass the -cluster parameter, one cluster works the other fails with an error ‘An item with the same key has already been added’. If I run Get-VsanComponent with a -Id parameter specific ID#, I get the same error. Unfortunately there is no -cluster parameter on Get-VsanComponent cmdlet to narrow scope. I’ll open a ticket with GSS. Thanks again!

  4. Hey Kim,

    To get the components for just one cluster, try:
    Get-VsanComponent -VsanObject (Get-Cluster -Name “ClusterName” | Get-VsanObject)

    Hope that helps, Jase

  5. Thanks Jase. I narrowed it down a bit more. I ran the command: Get-VsanObject -VsanObject (Get-VsanObject -type Vdisk -VM $VM)

    I can loop foreach VM in the cluster and get results on all VMs – but one.

    The one difference I found with VM that fails is it has 1.2 TB disk (> 255 GB max component size), so divided into multiple components. Am I missing a way to further iterate through the multiple components of the same VsanObject?

  6. Kim,

    I think you meant: Get-VsanComponent -VsanObject (Get-VsanObject -Type Vdisk -VM $VM).

    Objects themselves can easily be >255GB, but Components themselves cannot be >255GB.

    When I run the above command on a VM named RDC1, I get:
    PS /Users/jase> Get-VsanComponent -VsanObject (Get-VsanObject -Type Vdisk -VM “RDC1”)

    Cluster VsanDisk Status Type
    ——- ——– —— —-
    RemoteCluster naa.55cd2e404c17b746 ACTIVE Component
    RemoteCluster naa.55cd2e404c17bb9f ACTIVE Component
    RemoteCluster naa.55cd2e404c17b747 ACTIVE Witness

    The vmdk is a 40GB vmdk, and reports correctly.

    After adding a 400GB vmdk, this is what I see:
    PS /Users/jase> Get-VsanComponent -VsanObject (Get-VsanObject -Type Vdisk -VM “RDC1”)

    Cluster VsanDisk Status Type
    ——- ——– —— —-
    RemoteCluster naa.55cd2e404c17b6cf ACTIVE Component
    RemoteCluster naa.55cd2e404c17b743 ACTIVE Component
    RemoteCluster naa.55cd2e404c17b701 ACTIVE Component
    RemoteCluster naa.55cd2e404c17b741 ACTIVE Component
    RemoteCluster naa.55cd2e404c17b746 ACTIVE Component
    RemoteCluster naa.55cd2e404c17bb9f ACTIVE Component
    RemoteCluster naa.55cd2e404c17b747 ACTIVE Witness

    You’d think that I’d have 2 Witness components (one for each disk), but the 400GB vmdk is distributed across 4 nodes & no Witness is required.

    https://blogs.vmware.com/virtualblocks/files/2018/11/Get-VsanComponent-Placement.png illustrates the placement.

    The 1.2TB disk should be displayed. I’m wondering if you have a bug or other issue.

  7. Thanks Jase. I did type the command wrong in earlier reply. It was: Get-VsanComponent -VsanObject (Get-VsanObject -Type Vdisk -VM $VM) It do get an error with just one VM. Only difference I see with this VM compared to others is multiple components. I have a SR open with GSS on the problem.

Leave a Reply

Your email address will not be published.