Hello,
Using the vSphere client, there is a way to view the properties of a datastore (under Configuration tab, Storage) where it shows the Extent information which includes the UUID information on the LUN. Is there a way to view the same information in PowerCLI? Here's what I'm trying to do - given a datastore, I would like to identify the storage device which is holding it, preferably using something unique like the UUID. In the case of EMC devices at least, it contains the WWN for the device, so we can match up this with the storage information visible from the SAN. I've browsed the objects within get-datastore | get-view, but none of them seem to expose this.
Thanks,
Ed
Hi Ed,
Get-Datastore <Datastorename> | Get-Scsilun
gives you the extent in the CanonicalName property.
Regards, Robert
Hi Ed,
Get-Datastore <Datastorename> | Get-Scsilun
gives you the extent in the CanonicalName property.
Regards, Robert
So simple - works perfectly
Thanks!
Ed
Try this, it will give you the datastorename and the extent.
$report = @() Get-Datastore <datastorename> | Get-View | %{ $ds = $_ $esx = Get-View $ds.Host[0].Key $ds.Info.Vmfs.Extent | %{ $ext = $_ $extKey = ($esx.Config.StorageDevice.ScsiLun | where {$_.CanonicalName -eq $ext.DiskName}).Key $lun = $esx.Config.StorageDevice.MultipathInfo.Lun | where {$_.Lun -eq $extKey} $row = "" | Select ESXname, DSname, Extent, Partition, "Path Selection","Paths Total" $row.ESXname = $esx.Name $row.DSname = $ds.Name $row.Extent = $ext.DiskName $row.Partition = $ext.Partition $row."Path Selection" = &{ switch($lun.Policy.Policy){ "VMW_PSP_FIXED"{"Fixed"} "VMW_PSP_RR"{"Round Robin"} "VMW_PSP_MRU"{"Most Recently Used"} } } $row."Paths Total" = $lun.Path.Count $report += $row } } $report
And this will work with PowerCLI 4 as well.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
It's unable to get DSName on PowerCLI 4.1 U1 build 332441.
Hi Kevin,
Just ran it with PowerCLI 4.1 U1 and I see the datastore names in the report.
Do you get any error messages ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
unfortunately no errors. Is it for ESX version 4.0 and above?
Yes, it's for ESX 4.x
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is it possible get a version for ESX 3.x?
I'm afraid I don't have any ESX 3.x servers left, so it will be difficult to create a script 😞
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
will this works for Esxi and vcenter server 6.7 ?
And also I want to input a csv file with some Datastore Name to find the extent only for selected Datastore , could you please help me how I can add that in below script.