• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

Check your VSAN disk controllers against the HCL with PowerCLI

Duncan Epping · Feb 24, 2016 ·

Every now and then customers ask if it is possible to check if disk controllers are on the VSAN HCL (Or VMware Compatibility Guide (VCG) as it is actually called these days) for a given set of hosts through PowerCLI. Alan Renouf figured he would knock something out, thanks Alan for sharing! (Next up would be validate drivers and firmware of all components, thanks!) What this script does is the following, note that you need internet access for this to work:

  • Connect to vCenter
  • Download latest VSAN HCL details (json file)
  • Compare controllers of each host against the VSAN HCL
  • Report the state of your infra

Here is the script, it can also be found in the VMware Developer Center repository by the way.

Connect-VIServer myvcenter -user Administrator -password MyPass23
 
 
Function Get-CompatibleVSANController {
    if (-Not $vSANHCL) {
        $vSANHCL = Invoke-WebRequest -Uri http://partnerweb.vmware.com/service/vsan/all.json | ConvertFrom-Json
    }
    $vSANHCL.data.controller
}
 
$HBAs = get-vmhost | Get-VMHostPciDevice | where { $_.DeviceClass -eq "MassStorageController" }
 
Foreach ($HBA in $HBAs) {
    $HBAFound = $false
    Write-Host "Looking for $($hba.name) from host $($HBA.VMhost)"
    Foreach ($entry in Get-CompatibleVSANController) {
        $vid = [String]::Format("{0:x}", $HBA.VendorId)
              $did = [String]::Format("{0:x}", $HBA.DeviceId)
              $svid = [String]::Format("{0:x}", $HBA.SubVendorId)
        $ssid = [String]::Format("{0:x}", $HBA.SubDeviceId)
        If (($vid -eq $entry.vid) -and ($did -eq $entry.did) -and ($svid -eq $entry.svid) -and ($ssid -eq $entry.ssid) ) {
            Write-Host " HBA in $($HBA.VMHost) is $($HBA.Name) which can be found in the HCL as $($Entry.vendor) - $($Entry.Model) at the following URL: `n $($entry.vcglink)" -ForegroundColor Green
            $HBAFound = $true
        }
    }
    If (-Not $HBAFound){
        Write-Host " $($HBA.Name) in $($HBA.VMHost) is not found!" -ForegroundColor Red
    }
}

If you run it the output will look like this:

Share it:

  • Tweet

Related

Server, Software Defined, Storage, vSAN hcl, powercli, vcg, virtual san, VMware, vsan

Reader Interactions

Comments

  1. Steffen Oezcan says

    25 February, 2016 at 00:56

    Hi Duncan, I am just at a customer site with PSO and they would LOVE to use that – but their vCenter is and will stay disconnected from the Internet. We are building a process to automatically download and bring the updated json-File for the HCL to vCenter via the offline import. Any chance this script of Alan (thanks!) could be adjusted to work also against the vCenters imported json-offline file? Would be much appreciated.
    BR
    Steffen

  2. Alan Renouf says

    25 February, 2016 at 07:21

    Stefan,

    Sure, just change Line 6 to the following:

    $vSANHCL = Get-Content -Path C:\temp\all.json | ConvertFrom-Json

  3. Alex says

    29 February, 2016 at 16:50

    Great post Alan – this is JUST what I was looking for! Do you think you could enlarge the output example screenshot example?

    • Duncan Epping says

      29 February, 2016 at 22:44

      here is the full size output:
      https://c2.staticflickr.com/2/1660/25103202661_638b139518_o.png

      my blog theme doesn’t allow me to post pics this big, but this should work.

  4. caleb says

    4 March, 2016 at 16:28

    Great script. Like the others. I’ll be using it heavily.

    Have you found any way to trigger using Powercli the other various health tests for vSAN that are available from the web client? I would have thought that there would have been cdmlets included in Powercli 6 R3 vmware.vimautomation.storage module. But alas I came up short. any help is appreciated.

Primary Sidebar

About the author

Duncan Epping is a Chief Technologist in the Office of CTO of the Cloud Platform BU at VMware. He is a VCDX (# 007), the author of the "vSAN Deep Dive", the “vSphere Clustering Technical Deep Dive” series, and the host of the "Unexplored Territory" podcast.

Upcoming Events

Feb 9th – Irish VMUG
Feb 23rd – Swiss VMUG
March 7th – Dutch VMUG
May 24th – VMUG Poland
June 1st – VMUG Belgium

Recommended Reads

Sponsors

Want to support Yellow-Bricks? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2023 · Log in