Automation

 View Only
  • 1.  Not retrieving canonical name for only one ESXi host

    Posted Apr 18, 2018 01:11 PM

    Hello, I have the following script that works fine. Today I started upgrading a vCluster of ESXi v.6 to v.6.5. I formatted the first host, installed ESXi v.6.5 and added it to the vCluster successfully.I ran the script below and the output is missing only the canonical name aka naa ID in our case and only for the newly installed 6.5 host. Why would that be??

    $AllHosts = get-cluster "xxxx" | Get-VMHost  | Sort Name

    $reportLunPathState = @()

    $i = 0

    ForEach ($VMHost in $AllHosts) {

        $i++

        Write-Host "$($i) of $($AllHosts.length) - $($VMHost)"

        $VMHostScsiLuns = $VMHost | Get-ScsiLun | ?{$_.RuntimeName.Split(":")[3] -notmatch "L256|L257" -and $_.IsLocal -ne "True"}

        ForEach ($VMHostScsiLun in $VMHostScsiLuns) {

            $VMHostScsiLunPaths = $VMHostScsiLun | Get-ScsiLunPath

            $reportLunPathState += $VMHostScsiLunPaths | Select `

              @{N="naaID";E={(($_.Name).Split("-")[2]).TrimStart("naa.")}},`

              @{N="ESXiName"; E={$VMHost.Name}}, `

              @{N="LunTarget"; E={$_.SanID}}, `

              @{N="LUNpaths";E={($_.Name).Split(",")[0]}}

        }

    }

    $reportLunPathState

    the output is fine for all but the new host where the naa ID is missing. Below the output:

    6000d310006aa1000000000000000257 ESXi host v.6 50:00:D3:10:01:2E:12:39 vmhba1:C0:T0:L80

    6000d310006aa1000000000000000257 ESXi host v.6 50:00:D3:10:01:2E:12:41 vmhba2:C0:T9:L80

    6000d310006aa1000000000000000257 ESXi host v.6 50:00:D3:10:01:2E:12:35 vmhba1:C0:T2:L80

                                                                     ESXi host v.6.5 50:00:D3:10:01:2E:12:3F vmhba2:C0:T11:L9

                                                                     ESXi host v.6.5 50:00:D3:10:01:2E:12:37 vmhba1:C0:T4:L9

                                                                     ESXi host v.6.5 50:00:D3:10:01:2E:14:3A vmhba1:C0:T9:L9

    I've tried changing the line:

         @{N="naaID";E={(($_.Name).Split("-")[2]).TrimStart("naa.")}}

    into

    @{N="naaID";E={(($_.ScsiCanonicalName).Split("-")[2]).TrimStart("naa.")}}

    but same result.

    Message was edited by: JStars



  • 2.  RE: Not retrieving canonical name for only one ESXi host
    Best Answer

    Posted Apr 18, 2018 01:28 PM

    silly me... the line to be changed should reflect:

    @{N="naaID";E={(($_.ScsiCanonicalName).TrimStart("naa."))}} instead.

    However something has changed in v.6.5 in this respect..