VMware Cloud Community
vin01
Expert
Expert

need each disk info with lun and nna


Hi Guys

any script to get details of datastore name ,nna,& disk number,host ip..

For example

If vm  Test has 3disks, I need info like this

vm name,onwhich host

test.vmdk1-- datastore name and its nna

test.vmdk2-- datastore name and its nna

test.vmdk3-- datastore name and its nna

Regards Vineeth.K
Reply
0 Kudos
1 Reply
LittleNickey
Enthusiast
Enthusiast

Check out Robert van den Nieuwendijk's Blog post: Use PowerCLI to find the datastore from a disk name

That might be of help to you.

I've used his function to get some info that I'm interested in, but i'd like to point out that I've only just begun so not sure if this will be helpful for you:

$report = @()

foreach($esxhost in get-vmhost){

  foreach($lun in (get-scsilun -vmhost $esxhost.name -LunType disk)){

  $Summary = "" | Select VMHost, LunName, CanonicalName, Vendor, MPP

  $ds = Get-DatastoreByDiskName $lun.CanonicalName

  $Summary.VMHost = $esxhost.Name

  $Summary.LunName = $ds.Name

  $Summary.CanonicalName = $lun.CanonicalName

  $Summary.Vendor = $lun.Vendor

  $Summary.MPP = $lun.MultiPathPolicy

  $report += $Summary

  }

}

$report | export-csv -path C:\temp\out.csv -NoTypeInformation -UseCulture

This will give you a similar output like:

VMHost        : host.local

LunName       : LUN001

CanonicalName : naa.################################

Vendor        : HITACHI

MPP           : RoundRobin

-- Oskar
Reply
0 Kudos