LUN Runtime Name

Most vSphere Administrators need to inspect the LUN runtime names discovered by the ESXi hosts. What usually gets overlooked is that runtimes name across different hosts could be different. Hence I like to look at all the runtime names discovered across all hosts for that ‘said’ LUN. Here is an oneliner which does the same, pass the CanonicalName (NaaID) and it will tell you the RuntimeName:

function Get-DatastoreRuntimeName() {
    param (
        [string]$CanonicalName = $(Read-Host -prompt "Enter a CanonicalName")

    Get-VMHost `
        | Get-VMHostStorage `
        | Select-Object -ExpandProperty ScsiLun `
        | ?{$_.LunType -like "disk"} `
        | Select-Object VMHost,CanonicalName,RuntimeName,@{Name="CapacityGB";Expression={[int]$_.CapacityGB}} `
        | ?{$_.CanonicalName -like $CanonicalName}

What I usually do is find the NaaID for a Datastore and then use the NaaID to query the RuntimeName. Yes that’s a 2 step process. There might be an better way, but haven’t tried to explore it, since this gets my job done. šŸ˜‰


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s