VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Get LUN ID of Datastore

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

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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')}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

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')}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

ganapa2000
Hot Shot
Hot Shot
Jump to solution

Perfect...on dot...as always Smiley Happy

you rock LucD

0 Kudos