Last active
January 7, 2017 20:17
-
-
Save alanrenouf/9b82e9315ee86e759402 to your computer and use it in GitHub Desktop.
Check Host HBAs against the VSAN HCL automatically.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-VIServer myvcenter -user Administrator -password MyPass23 | |
Function Get-VsanHclDatabase { | |
<# | |
.NOTES | |
=========================================================================== | |
Created by: Alan Renouf | |
Organization: VMware | |
Blog: http://virtu-al.net | |
Twitter: @alanrenouf | |
=========================================================================== | |
.SYNOPSIS | |
This function will allow you to view and download the VSAN Hardware Compatability List (HCL) Database | |
.DESCRIPTION | |
Use this function to view or download the VSAN HCL | |
.EXAMPLE | |
View the latest online HCL Database from online source | |
PS C:\> Get-VsanHclDatabase | Format-Table | |
.EXAMPLE | |
Download the latest HCL Database from online source and store locally | |
PS C:\> Get-VsanHclDatabase -filepath ~/hcl.json | |
#> | |
param ($filepath) | |
$uri = "https://partnerweb.vmware.com/service/vsan/all.json" | |
If ($filepath) { | |
Invoke-WebRequest -Uri $uri -OutFile $filepath | |
} Else { | |
Invoke-WebRequest -Uri $uri | ConvertFrom-Json | Select-Object -ExpandProperty Data | Select-object -ExpandProperty 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-VsanHclDatabase) { | |
$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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment