Find out Frame and LUN ID for VM RDM's from a Symmetrix/vMax Array.

Summary:
I was looking for a way to translate RDM info into a simple frame and SCSI ID.  I took my Naa.ID script and modified to look @ it in this way.  RDM's are needed for EMC based management tools, that's pretty much the only reason I use RDM's.

Usage:

  1. Save the below script as a .psm1 file.
  2. Import-Module Convert-LUNUuidToVMaxFrameandDeviceId.psm1 file (I happened to name my psm1 file the same as the function name.  You can name it differently if you want.)
  3. Convert-LUNUuidToVmaxFrameAndDeviceId #############################
    1. This'll return a Frame and Device value written to screen.
  4. Below you can see how to get the LUNUUid info and how you batch the info.


Script:


# Batch scripting information
#$TVM = Get-VM 
#$Devices = $TVM.extensiondata.config.hardware.device
#$DeviceBacking = @()
#foreach ($device in $devices) {$devicebacking += $device.backing}
#$devicebacking = $devicebacking | where {$_.lunuuid -ne $null}
#foreach ($device in $devicebacking){Convert-LUNUuidToVMaxFrameandDeviceId $device.lunuuid}

Function Convert-LUNUuidToVmaxFrameAndDeviceId ($LUNUuid) {
  if ($LUNUuid.length -ne 54) { "LUNUuid must be 54 characters"; break }
  $deviceString = $LUNUUid.ToCharArray()
  # Prepended w/ Frame info.
  $device = ("Frame $($deviceString[26])$($deviceString[27])$($deviceString[28])$($deviceString[29]) Device ") 
  $device += [char][Convert]::ToInt32("$($deviceString[32])$($deviceString[33])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[34])$($deviceString[35])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[36])$($deviceString[37])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[38])$($deviceString[39])", 16)
  $device += [char][Convert]::ToInt32("$($deviceString[40])$($deviceString[41])", 16)
  return $device
}

Comments

Popular posts from this blog

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.

vCenter: Cluster Skip Quickstart Workflow via API