Finding VMware Datastores by their NAA name with PowerCLI

VMware events generally do a pretty decent job of letting you know what is going in an enviroment… however sometimes the event just doesn’t give you nearly enough information.

Great, alright so one of our datastores/Luns is having latency issues. Sounds like something I should look into…

Oh Wait, I don’t have every datastore memorized by its NAA name…shucks

So a quick solution, as it is for most things…POWERCLI!!!!

Fortunately, this is a quick and easy one-liner

get-datastore |Where-Object { $_.extensiondata.info.vmfs.extent.diskname -like “*$diskname*”}

Where $diskname is any part of the naa name, you might have to put several characters in for $diskname just to make sure you don’t get multiple results…but it is really that easy!

I tossed it into a function for faster use!

I know the quick one-liner has made my life easier. Is it helpful to you as well?

Leave a Reply