Check your VSAN disk controllers on VCG with PowerCLI

December 14, 2016

An easy way of checking your hosts compatibility against vSAN HCL as per VMware.

  • 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

Below script is also available on VMware Developer Center as well –

 

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:

 

 

 

 

Tags:

Share on Facebook
Share on Twitter
Please reload

Featured Posts

I'm busy working on my blog posts. Watch this space!

Please reload

Recent Posts
Please reload

Archive