Hello,
I'm new to PowerCLI and I am trying to run a report which will resolve the Datastore Name to my LUN ID so that I can start cleaning up my datastore. I have this script -
Get-DataStore | Get-ScsiLun -CanonicalName "naa.*" | Export-Csv C:\Users\bsodd\LUNid.csv
Which works well but doesn't give the info I need unfortunately.
How do I get the Datastore Name to resolve to the LUN ID, is there a script that I can use to get this info?
Thanks in advance
you were on the right way
the lun ID is defined in the property runtimeName of get-scsilun :
PowerCLI C:\> $datastore[0] | select *
Id : HostSystem-host-65536/naa.600014400000001020248cb06552602b
CanonicalName : naa.600014400000001020248cb06552602b
RuntimeName : vmhba0:C0:T4:L1
Key : key-vim.host.ScsiDisk-0200010000600014400000001020248cb06552602b496e76697374
LunType : disk
Model : Invista
SerialNumber : unavailable
Vendor : EMC
ConsoleDeviceName : /vmfs/devices/disks/naa.600014400000001020248cb06552602b
CapacityMB : 1536000
CapacityGB : 1500
MultipathPolicy : RoundRobin
CommandsToSwitchPath : 1000
BlocksToSwitchPath : 10240
HostId : HostSystem-host-65536
VMHostId : HostSystem-host-65536
VMHost :
Uid : /VIServer=3/VMHost=HostSystem-host-65536/ScsiLun=naa.600014400000001020248
cb06552602b/
IsLocal : False
ExtensionData : VMware.Vim.HostScsiDisk
the last part of the RuntimeName is the LUNID. In this emxample LUNID 1
to get the datastore name i would recommend to create a custom object
this could also help: