Automation

 View Only
Expand all | Collapse all

PowerCLI question - resolve the Datastore Name to LUN ID

  • 1.  PowerCLI question - resolve the Datastore Name to LUN ID

    Posted Aug 27, 2015 09:13 AM

    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 -

    Powershell

    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



  • 2.  RE: PowerCLI question - resolve the Datastore Name to LUN ID

    Posted Aug 27, 2015 11:36 AM

    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



  • 3.  RE: PowerCLI question - resolve the Datastore Name to LUN ID

    Posted Aug 27, 2015 11:40 AM

    this could also help:

    How to get LUN ID ?