I try to enumerate all hosts, vm's and storage-adapters in my vCenter-infrastructure by using the vmware.vim-library in vb.net.
But I cannot find a way to get the WWN from the HBA...in powershell there is a property called 'portworldwidename' but this is not available using .net.
foreach($hba in $esx.Config.StorageDevice.HostBusAdapter){
if($hba.GetType().Name -eq "HostFibreChannelHba"){
$wwn = $hba.PortWorldWideName
$wwnhex = "{0:x}" -f $wwn
Write-Host $wwnhex
}
}
This is what I have in vb.net:
Dim c As New VimClient
c.Connect("https://myvcenter/sdk")
c.Login("username", "password")
Dim vmsHosts = c.FindEntityViews(GetType(HostSystem), Nothing, Nothing, Nothing)
For Each evbHostSystem In vmsHosts
Dim hs = CType(evbHostSystem, HostSystem)
Console.WriteLine(hs.Name)
Dim hbas = hs.Config.StorageDevice.HostBusAdapter
For Each hba In hbas
Console.WriteLine(hba.Model)
'hba.portworldwidename is not available...
Next
Next
Thanks for any help!
Regards, Jan