VMware Cloud Community
nava_thulasi39

Need a script to get Datastore with naa identifier

Hi Experts,

Hope, It might be asked earlier as well as answered.

I need to get the details of datastore with naa identifier on the cluster or entire vcenter.

get-scsilun - give naa identifier but not the Datastore name.

Any help?

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
4 Replies
LucD
Leadership
Leadership

My LUN report – datastore, RDM and node visibility post has a script that shows how to report on that relation.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
markdjones82
Expert
Expert

Not as sophisticated as Luc's, but easy to run nonethless and you can pass a datacetner or cluster.

Get-cluster cluster | get-vmhost | foreach {Write-Host; $_.Name; $_ | Get-Datastore | Select Name,@{N='Naa';E={($_ | Get-View).Info.Vmfs.Extent.Diskname}} }

Luc, I was having issues on this and was hoping you could help caus I'd like to actually use this myself.  For this command how could I have it put the hostname lined up with each datastore?

Right now it looks like this:

hostname

Name                    NAA

datastore               naa.12313123123123123

How could I have it look like this:

Hostname      Name                    NAA

Hostname      datastore               naa.12313123123123123

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
LucD
Leadership
Leadership

Since this is for a cluster and most datastores will be shared I would do something like this

Get-Cluster cluster | Get-VMHost | Get-Datastore | 
Select Name, 
@{N="Hosts";E={[string]::Join(',',($_.ExtensionData.Host | %{Get-View $_.Key | Select -ExpandProperty Name}))}},
@{N='Naa';E={[string]::Join(',',($_.ExtensionData.Info.Vmfs.Extent | Select -ExpandProperty DiskName))}} |
fl


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
markdjones82
Expert
Expert

Cool that works, thanks again, I don't know how you do this stuff man.  It's like you are a powercli savant!

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos