8 Replies Latest reply on May 30, 2019 2:08 AM by ganapa2000

    IsPerenniallyReserved status shows blank

    ganapa2000 Hot Shot

      Hi,

       

      Unable to get IsPerenniallyReserved status as it shows blank

       

      Get-VMHost 172.27.3.8 | Get-ScsiLun -LunType disk |

      Select VMHost,

          @{n='LUN';E={

              $esxcli = Get-EsxCli -VMHost $_.VMHost -V2

              $esxcli.storage.nmp.path.list.Invoke(@{'device'=$_.CanonicalName}).RuntimeName.Split(':')[-1].TrimStart('L')}},

      Vendor, LunType,CapacityGB, MultipathPolicy,

      @{N='IsPerenniallyReserved';E={($esxcli.storage.core.device.list.invoke(@{'device'=$_.CanonicalName}) | Select -ExpandProperty IsPerenniallyReserved)}} |

      Sort-Object -Property {[int]$_.LUN} | ft -auto

       

      Please help.

        • 1. Re: IsPerenniallyReserved status shows blank
          LucD Guru
          Community WarriorsvExpertUser Moderators

          You can do this all with Get-EsxCli, which is a lot faster than Get-ScsiLun.
          Something like this

           

          $esxcli = Get-VMHost -Name 172.27.3.8 | Get-EsxCli -v2

          $esxcli.storage.core.device.list.Invoke() |

          where { $_.DeviceType -eq 'Direct-Access' } |

          Select Vendor, DeviceType,

          @{N = 'CapacityGB'; E = { $_.Size / 1KB } },

          @{N = 'MultipathPolicy'; E = { ($esxcli.storage.nmp.device.list.Invoke(@{device = $_.Device })).PathSelectionPolicy } },

          @{N = 'LUN'; E = { $_.Device.Split(':')[-1].TrimStart('L') } },

          IsPerenniallyReserved

          • 2. Re: IsPerenniallyReserved status shows blank
            ganapa2000 Hot Shot

            LucD,

             

            Now I am able to get IsPerenniallyReserved but I unable to get ConsoleDeviceName and LUN ID as both shows blank

             

            $esxcli = Get-VMHost -Name 172.27.3.8 | Get-EsxCli -v2

            $esxcli.storage.core.device.list.Invoke() |

            where { $_.DeviceType -eq 'Direct-Access' } |

            Select Vendor, DeviceType,

            @{N = 'CapacityGB'; E = { $_.Size / 1KB } },

            @{N = 'MultipathPolicy'; E = { ($esxcli.storage.nmp.device.list.Invoke(@{device = $_.Device })).PathSelectionPolicy } },

            @{N = 'CanonicalName'; E = { $_.Device.Split(':')[-1].TrimStart('L') } },

            @{N='LUN ID'; E={$d = $_; ((Get-ScsiLun -VmHost $esxcli | Where {$_.CanonicalName -eq $_.Device}).RuntimeName -split ':' | Select -last 1).TrimStart('L')}},

            IsPerenniallyReserved, ConsoleDeviceName | ft  -auto

            • 3. Re: IsPerenniallyReserved status shows blank
              LucD Guru
              User ModeratorsCommunity WarriorsvExpert

              The ConsoelDeviceName is shown as DevfsPath.

               

              $esxcli = Get-VMHost -Name 172.27.3.8 | Get-EsxCli -v2

              $esxcli.storage.core.device.list.Invoke() |

              where { $_.DeviceType -eq 'Direct-Access' } |

              Select Vendor, DeviceType,

              @{N = 'CapacityGB'; E = { $_.Size / 1KB } },

              @{N = 'MultipathPolicy'; E = { ($esxcli.storage.nmp.device.list.Invoke(@{device = $_.Device })).PathSelectionPolicy } },

              @{N = 'LUN'; E = { $_.Device.Split(':')[-1].TrimStart('L') } },

              IsPerenniallyReserved,

              @{N = 'ConsoleDeviceName'; E = { $_.DevfsPath } }


              The LUN ID works for me. How is the Device returned in your environment?

              Do a


              $
              esxcli.storage.core.device.list.Invoke() |

               

              where { $_.DeviceType -eq 'Direct-Access' } | Select Device

              • 4. Re: IsPerenniallyReserved status shows blank
                ganapa2000 Hot Shot

                Hi LucD,

                 

                Sorry for the confusion, I can see LUN like naa.60030130......but I would like to get the LUN number (2 or 3 or 5) of the device on the host.

                • 5. Re: IsPerenniallyReserved status shows blank
                  LucD Guru
                  Community WarriorsUser ModeratorsvExpert

                  No problem.
                  Is that LUN ID available in any of the following properties?

                   

                  $esxcli.storage.core.device.list.Invoke() |

                  where { $_.DeviceType -eq 'Direct-Access' } |

                  Select Device, DevfsPath, DisplayName

                   

                  If not, can you show me the complete output for 1 LUN?

                   

                  $esxcli.storage.core.device.list.Invoke() |

                  where { $_.DeviceType -eq 'Direct-Access' } |

                  Select -First 1 -Property *

                  • 6. Re: IsPerenniallyReserved status shows blank
                    ganapa2000 Hot Shot

                    LucD,

                     

                    I need the LUN Number as below

                     

                     

                    also I dont see LUN number from below query.

                     

                    $esxcli.storage.core.device.list.Invoke() |

                    where { $_.DeviceType -eq 'Direct-Access' } |

                    Select Device, DevfsPath, DisplayName

                     

                    If not, can you show me the complete output for 1 LUN?

                     

                    $esxcli.storage.core.device.list.Invoke() |

                    where { $_.DeviceType -eq 'Direct-Access' } |

                    Select -First 1 -Property *

                     

                    • 7. Re: IsPerenniallyReserved status shows blank
                      LucD Guru
                      Community WarriorsvExpertUser Moderators

                      Does this return the LUN ID?

                       

                      $esxcli = Get-VMHost -Name 172.27.3.8 | Get-EsxCli -v2

                      $esxcli.storage.core.device.list.Invoke() |

                      where{$_.DeviceType -eq 'Direct-Access'} |

                      Select Vendor, DeviceType,

                         @{N='CapacityGB';E={$_.Size/1KB}},

                         @{N='MultipathPolicy';E={($esxcli.storage.nmp.device.list.Invoke(@{device=$_.Device})).PathSelectionPolicy}},

                         @{N='LUN';E={($esxcli.storage.nmp.path.list.Invoke(@{device=$_.Device})).RuntimeName.Split(':')[-1].TrimStart('L')}},

                        IsPerenniallyReserved,

                         @{N='ConsoleDeviceName';E={$_.DevfsPath}}

                      • 8. Re: IsPerenniallyReserved status shows blank
                        ganapa2000 Hot Shot

                        Perfect, that worked

                         

                        Thank you very much.