NAA ID To VMAX Device ID – using powershell

A few months ago I noticed a link to this awesome article titled: NAA id’s and breaking them apart, which dissects the NAA identifiers that you see in the vSphere client when looking at storage devices. Recently I was working with my storage admin — I was seeing a 2.81MB device on all of the hosts in a cluster that he had not specifically presented. Unfortunately I had no good way to tell him exactly which device I was seeing. I then remembered and found this article and was able to convert the NAA ID to the VMAX device ID using the key described in the article. While converting this device ID by hand, I thought…wouldn’t it be nice if I could just paste in the NAA ID and automatically convert it to the device ID? I threw together a quick powershell function that does just that:

Function Convert-NaaIdToVmaxDeviceId ($naa) {
  if ($naa.length -ne 36) { "NAA value must be 36 characters"; break }
  $deviceString = $naa.ToCharArray()
  $device = [char][Convert]::ToInt32("$($deviceString[26])$($deviceString[27])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[28])$($deviceString[29])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[30])$($deviceString[31])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[32])$($deviceString[33])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[34])$($deviceString[35])", 16)
  return $device

The function expects just one parameter and can be used like this:

Convert-NaaIdToVmaxDeviceId "naa.60000970000000000000533031363641"


  1. Just FYI for those adverse to CLI, EMC has a free plug-in to the vSphere Client that will do this for you. It is called Virtual Storage Integrator and can be found here:

    Not only will it provide the device ID, but also list out things such as RAID, device type (thin, thick), thin pool(s), metavolume configuration, etc.

  2. Kanuj Behl says:

    Very cool, thanks.

  3. Sam says:

    Is there a way to covert this to read from and write to csv? I can not get the $device to output to Export-csv. Throws error null!

  4. Sam says:

    Function NaaDeviceId {
    Param ([string]$filename)
    $LUNs = Import-CSV $filename
    foreach ($Disk in $LUNs) {
    $naa = $Disk.Naa

    if ($naa.length -ne 36) { “NAA value must be 36 characters”; break }
    $deviceString = $naa.ToCharArray()
    $device = [char][Convert]::ToInt32(“$($deviceString[26])$($deviceString[27])”, 16)
    $device += [char][Convert]::ToInt32(“$($deviceString[28])$($deviceString[29])”, 16)
    $device += [char][Convert]::ToInt32(“$($deviceString[30])$($deviceString[31])”, 16)
    $device += [char][Convert]::ToInt32(“$($deviceString[32])$($deviceString[33])”, 16)
    $device += [char][Convert]::ToInt32(“$($deviceString[34])$($deviceString[35])”, 16)
    $|Export-Csv “C:\temp\NaaDeviceID.csv” -NoTypeInformation

    NaaDeviceId “C:\temp\Protection Group_Builds\naasafe.csv”

  5. Sam – yes, this can be done. Here are two examples that use the function in the original post.

    First, one to do exactly what you asked:

    Import-Csv C:\tmp\naaSafe.csv | %{ 
      Add-Member -MemberType NoteProperty -Name "VmaxDeviceId" -Value $(Convert-NaaIdToVmaxDeviceId ($_.NaaId)) -passthru -InputObject $_ 
    } | Export-Csv c:\tmp\naaSafeOut.csv -NoTypeInformation

    And second, one to get the information from PowerCLI and export it to CSV — note this assumes that each VMFS volume contains only one Extent

    Get-Datastore | ?{$_.Type -eq 'VMFS' -and $_.ExtensionData.Summary.MultipleHostAccess} | 
    Select-Object Name, FreeSpaceMB, CapacityMB,
    @{N="VmaxDeviceId";E={ (Convert-NaaIDToVmaxDeviceId $[0].DiskName) }} |
    Export-Csv "C:\tmp\myNaaIds.csv" -NoTypeInformation
  6. Sam says:

    First, one


    Convert-NaaIdToVmaxDeviceId : The term ‘Convert-NaaIdToVmaxDeviceId’ is not recognized as the name of a cmdlet, function, script
    file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    At C:\Save-WK\Scripts\NaaConvert2.ps1:11 char:69
    + Add-Member -MemberType NoteProperty -Name “VmaxDeviceId” -Value $(Convert-NaaI …
    + ~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Convert-NaaIdToVmaxDeviceId:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  7. Jade says:

    Very useful post! I have a snippit to identify devices from a given Frame S/N here:

    But I will definitely be expanding it with this code example; being able to know the exact device ID is imperative to being able to work with any storage type.



  8. DesignLove says:

    Thanks for this tip,

    Does this work for Powershell v3.0? If it does I was wondering how do I convert DeviceID from SQLserver into a decimal value when printed? E.g. $DeviceID = $disk.DeviceID $deviceSpaceVal = $DeviceID.toDecimal. I have tried but it doesn’t work.

    Help please,

  9. Nagaraj says:


    Can I have your contact number please

Leave a Reply

Your email address will not be published. Required fields are marked *


Notify me of followup comments via e-mail. You can also subscribe without commenting.