An internal request came up asking for the ability to return the enclosure location of a vSAN disk.
This information can sometimes be returned from the esxcli command utility, for some storage controllers, using the following command:
esxcli storage core device physical get -d <device id>
The resulting output looks something like this:
Having to perform that command for a large number of disks could take a significant amount of time and could be quite burdensome.
In the vSphere Client, this information is displayed Cluster > Configure > vSAN > Disk Management section, choosing to show disks By Disk Vendors.
But what if we want to programmatically report this information from PowerCLI?
PowerCLI can already report the storage devices on an ESXi host host using the Get-ScsiLun cmdlet. A significant amount of information is returned from the Get-ScsiLun cmdlet such as the Adapter the disk is attached to, whether the disk is an SSD, if it is eligible for vSAN and more. Unfortunately though, this cmdlet does not report the "Physical Location" property.
By combining the Get-ScsiLun cmdlet, as well as using the power of Get-EsxCli (version 2 of course), this information can be put together to create a quick and easy report for all the hosts in a cluster.
This script can be found here: https://code.vmware.com/samples/5539