PowerCLI

 View Only
  • 1.  Get LUN ID of Datastore

    Posted Jun 07, 2017 04:05 PM

    Hi,

    Need help in getting the size and LUN ID of the datastore

    Get-Datastore |

    Select Name,

        @{N='DateTime';E={Get-DateTime}},

        @{N='CanonicalName';E={$_.ExtensionData.Info.Vmfs.Extent[0].DiskName}}

    Thanks

    Madhusudan



  • 2.  RE: Get LUN ID of Datastore
    Best Answer

    Posted Jun 07, 2017 05:03 PM

    Try something like this

    Get-Datastore |

    Select Name,CapacityGB,

        @{N='DateTime';E={Get-Date}},

        @{N='CanonicalName';E={$_.ExtensionData.Info.Vmfs.Extent[0].DiskName}},

        @{N='LUN';E={

            $esx = Get-View -Id $_.ExtensionData.Host[0].Key -Property Name

            $dev = $_.ExtensionData.Info.Vmfs.Extent[0].DiskName

            $esxcli = Get-EsxCli -VMHost $esx.Name -V2

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



  • 3.  RE: Get LUN ID of Datastore

    Posted Jun 08, 2017 03:46 AM

    Perfect...on dot...as always :smileyhappy:

    you rock LucD