Skip to main content

To get HBA details of all ESX host on a cluster

#Initialize variables
# $VCServer = ""

#Connect to vCenter Server
#Connect-VIServer $VCServer
$i = 0
$objHba = @()

$cnt = (Get-Content clusters.txt).Count

Get-Content clusters.txt | ForEach-Object {
$i++

$currclust = $_

$cluster = Get-cluster $currclust

    try{
      Write-Progress -Activity "Scanning .... " -Status ("Cluster : {0}" -f $cluster) -PercentComplete ($i/$cnt*100) -Id 1
    }
     catch [System.DivideByZeroException]{ }


    $vmhosts = $cluster | Get-vmhost
    if ($null -ne $vmhosts) {
        foreach ($vmhost in $vmhosts) {
            $vmhostview = $vmhost | Get-View
            foreach ($hba in $vmhostview.config.storagedevice.hostbusadapter) {
                if ($hba.PortWorldWideName) {
                    #Define Custom object
                    $objWwpn = "" | Select Clustername,Hostname,Hba,WWNN,WWPN
                    #Add porperties to the newly created object
                    $objWwpn.ClusterName = $cluster.Name
                    $objWwpn.HostName = $vmhost.Name
                    $objWwpn.Hba = $hba.Device
            $objWwpn.Wwnn = "{0:x}" -f $hba.NodeWorldWideName
                    $objWwpn.Wwpn = "{0:x}" -f $hba.PortWorldWideName
                    $objHba += $ObjWwpn
                }
            }
    }
    }
}

$objHba | Export-Csv -NoTypeInformation -UseCulture HbaInfo.csv

Comments

Popular posts from this blog

Console Mouse Not Working in Windows 2012 VMs

I recently ran into some problems while deploying a Windows Server 2012 R2 VM in my vSphere 6.5 U2 lab. I’ve come to expect that the console mouse response is going to be terrible until VMware Tools is installed, but for some odd reason I had no mouse control whatsoever. Thinking it may be a quirk of the Web Console, I tried both the Remote Console and the HTML5 client to no avail. The VM appeared to be healthy and would register keyboard input, but the motion of the mouse cursor was erratic or the cursor would not move at all. Thinking that I just needed to battle on and get Tools installed, I attempted to use the keyboard for this purpose – what a chore. You think it would have been easy, but the installer kept losing focus and falling behind other open windows. Many of the windows keyboard shortcuts I’d normally use were not functioning because they register on my laptop – not in the console. I couldn’t RDP to the VM either because the NIC needed to be configured with a vali...

VxRail 4.0 – Scale Out

The above is the physical diagram of VxRail Cluster (3 nodes). In this post I will show how to add one VxRail Appliance into this VxRail Cluster (From 3 nodes to 4 nodes). NOTE: The model of each VxRail Appliance is E460. Before the node expansion, you need to verify each Appliance is running in health in dashboard of VxRail Manager. The above is the final physical diagram of VxRail Cluster after scale out. Now we start the node expansion. You have just mounted a new VxRail Appliance (E460) and cabled it up to the top of each rack switch. When you power it on you can see a notification appear in the top left corner of VxRail dashboard. Click “ Add Node “. When you initially configured your VxRail Appliance, you specified an IP pool for ESXi, vMotion and vSAN. You can see that there available IP addresses in these pools, so the only additional action is to set an ESXi password. Click the scroll bar, then click the “ ESXi Password “. Enter the  ESXi  and ...

vCenter Server Options on VxRail Appliance

In this post we will discuss the pros and cons of vCenter Server deployment on VxRail. During VxRail initialization we can choose two options for vCenter Server deployment, both options are “Deploy new vCenter Server Appliance (VCSA)” and “Join existing vCenter Server”. We should know its limitation before we choose the each option. You can find the details as below. If we choose the bundle vCenter Server deployment The vCenter Service Server Appliance (VCSA), vCenter Server Platform Services Controller (PSC) and vRealize Log Insight VM are already pre-loaded on each VxRail node. When VxRail initialization it can deploy these VMs automatically based on our business requirement. Pros The vCenter Server (VCSA) deployment is done automatically. When installing software package upgrade for the VxRail Manager, both VCSA and PSC includes the processing of package upgrade. VMware Log Insight is deployed automatically The vCenter license is bundled on VxRail Appliance. C...