WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Getting started w/the new PowerCLI 6.5.1 Get-VsanView cmdlet

Getting started w/the new PowerCLI 6.5.1 Get-VsanView cmdlet

04.21.2017 by William Lam // 1 Comment

One of the things that I am most excited about from an Automation standpoint with the vSAN 6.6 release is that customers using PowerCLI will now have complete access to the vSAN Management API which we had initially introduced back in vSphere 6.0 Update 2. In PowerCLI 6.5R1, customers only had access to high level vSAN cmdlets which did a pretty good job covering the broad set of vSAN functionality. However, it did not expose the complete vSAN Management API and this has been something many customers have been asking about.

With the new PowerCLI 6.5.1 release, a new Get-VsanView cmdlet is now available that will exposes the complete vSAN Management API using PowerCLI. Since the vSAN Management API has been around since vSphere 6.0 Update 2, you will also be able to use this new cmdlet against a vSAN 6.2, vSAN 6.5 and vSAN 6.6 environment! You simply just need to update your PowerCLI installation which you should always do to get the latest fixes and enhancements.

When you connect to either a vCenter Server and/or ESXi host, you will be able to view all available vSAN Managed Objects for the system by simply running the cmdlet without any arguments as shown in the screenshot below.


If you wish to access a specific vSAN Managed Object type, then you will need to pass in the vSAN MoRef ID from the given list. Here is an example of accessing the "VsanVcClusterHealthSystem-vsan-cluster-health-system" which will give us access to the VsanVcClusterHealthSystem.

Get-VsanView -Id "VsanVcClusterHealthSystem-vsan-cluster-health-system"


Once we have access to the specific vSAN Managed Object, then you can access it like you normally would by piping that into Get-Member (gm) to see what operations are available which you should refer to the vSAN Management API for more details.

Lets go through a complete example demonstrating how to access one of the vSAN Management APIs, specifically with retrieving the version of vSAN both from a vCenter Server and ESXi standpoint. The following PowerCLI function (can also be downloaded here) will connect to the vSAN Health System and use the VsanVcClusterQueryVerifyHealthSystemVersions() method and passing in a vSAN Cluster to retrieve the version information.

Function Get-VSANVersion {
   param(
        [Parameter(Mandatory=$true)][String]$Cluster
    )
    $vchs = Get-VsanView -Id "VsanVcClusterHealthSystem-vsan-cluster-health-system"
    $cluster_view = (Get-Cluster -Name $Cluster).ExtensionData.MoRef
    $results = $vchs.VsanVcClusterQueryVerifyHealthSystemVersions($cluster_view)

    Write-Host "`nVC Version:"$results.VcVersion
    $results.HostResults | Select Hostname, Version
}

To use this function, simply connect to your vCenter Server and pass in the name of a vSAN Cluster as shown below:

Get-VSANVersion -Cluster VSAN-Cluster


From the output, we can see the version of vSAN at the vCenter Server level as well as for the individual ESXi host which can be handy if you want to check the current running version before performing an upgrade. Hopefully this provided you with a nice overview of the new Get-VSANView cmdlet and how to access the vSAN Management API. I think this is going to open the door for all sorts of cool vSAN Automation use cases with PowerCLI, look forward to seeing what the community comes up with!

Additional vSAN Mgmt API/PowerCLI Sample:

  • Get-VSANSmartsData.ps1

Lastly, I thought it might be useful to provide a nice table summarizing the vSAN Managed Objects that are available when connecting to either a vCenter Server and/or ESXi host which could also be used as quick reference. Another handy resource is the vSAN Management 6.6 API Quick Reference that I have created which will provide you a nice overview of the entire vSAN Management API as well as links to the API reference on how to use the APIs. Definitely worth bookmarking for those looking to do some vSAN Automation using the new PowerCLI Get-VsanView!

vCenter Server

vSAN Managed Object vSAN MoRef ID
VsanCapabilitySystem VsanCapabilitySystem-vsan-vc-capability-system
VsanVcClusterConfigSystem VsanVcClusterConfigSystem-vsan-cluster-config-system
VsanVcStretchedClusterSystem VimClusterVsanVcStretchedClusterSystem-vsan-stretched-cluster-system
VsanVcDiskManagementSystem VimClusterVsanVcDiskManagementSystem-vsan-disk-management-system
VsanVcClusterHealthSystem VsanVcClusterHealthSystem-vsan-cluster-health-system
VsanUpgradeSystemEx VsanUpgradeSystemEx-vsan-upgrade-systemex
VsanSpaceReportSystem VsanSpaceReportSystem-vsan-cluster-space-report-system
VsanIscsiTargetSystem VsanIscsiTargetSystem-vsan-cluster-iscsi-target-system
VsanVdsSystem VsanVdsSystem-vsan-vds-system
VsanPhoneHomeSystem VsanPhoneHomeSystem-vsan-phonehome-system
VsanMassCollector VsanMassCollector-vsan-mass-collector
VsanPerformanceManager VsanPerformanceManager-vsan-performance-manager
VsanObjectSystem VsanObjectSystem-vsan-object-system
VsanVcsaDeployerSystem VsanVcsaDeployerSystem-vsan-vcsa-deployer-system
VsanUpdateManager VsanUpdateManager-vsan-update-manager

ESXi

vSAN Managed Object vSAN MoRef ID
HostVsanHealthSystem HostVsanHealthSystem-ha-vsan-health-system
VsanPerformanceManager VsanPerformanceManager-vsan-performance-manager
VsanObjectSystem VsanObjectSystem-vsan-object-system
VsanVcsaDeployerSystem VsanVcsaDeployerSystem-vsan-vcsa-deployer-system
VsanUpdateManager VsanUpdateManager-vsan-update-manager

More from my site

  • Correlating vSAN perf metrics from vSphere Web Client to both PowerCLI & vSAN Mgmt API
  • Managing & silencing vSAN Health Checks using PowerCLI
  • SMART drive data now available using vSAN Management 6.6 API
  • New vSAN Management 6.6 API / SDKs / CLIs
  • Quick Tip - Retrieving vSAN File Share Network Permissions using vSAN API & PowerCLI

Categories // Automation, PowerCLI, VSAN, vSphere 6.5 Tags // PowerCLI, VSAN 6.6

Comments

  1. *protectedRoman Gelman says

    04/26/2017 at 9:24 pm

    Hi William,
    Great article.
    The community comes up with VSAN PowerCLI module
    https://github.com/rgel/PowerCLi

    Reply

Thanks for the comment!Cancel reply

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

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...