Wednesday, July 3, 2013

PowerCLI - Identify LUN names for each datastore

Nice quick and easy script with Powercli for identify the LUN names for each datastore.
This is useful for debugging the log files where only the LUN name is specified.

I am a big fan of Powergui where i run and create all my scripts in!
http://powergui.org/index.jspa
http://communities.vmware.com/community/vmtn/automationtools/powercli


Script:
(replace localhost with your own vcenter server)

Connect-VIServer localhost
Get-VMHost | Get-Datastore | where {$_.Type -eq "VMFS"} |
Select Name,@{N="LUN";E={(Get-ScsiLun -Datastore $_ | Select -First 1).CanonicalName}}


Disclaimer:
Please use this script at your own risk and test it out in your test lab first before using it in production.

No comments:

Post a Comment