During a Windows Server 2012 R2 Hyper-V implementation I needed to identify all the iSCSI disks (LUNs) presented by an EMC VNX SAN to the Hyper-v Failover cluster. Each presented iSCSI disk has a unique LUN ID. To View the LUN ID of a disk, you can use the diskpart command. Here are the steps to view the LUN ID of a disk:
- View the disks
- Select a disk
select disk <number>
- View the LUN ID of the disk
I didn’t find a PowerShell command to view the LUN IDs. You can create a PowerShell script that uses Diskpart to view all the disks and the corresponding LUN IDs.
2 thoughts on “Identify LUN IDs in Windows Server 2012 R2”
I’m not at work now so I don’t have access to my script library. I think the WMI Class Win32_DiskDrive class has this attribute as well. So something like
Get-WmiObject Win32_DiskDrive | Select Name, SCSIBus,SCSILun
So i dug into the WMI and wanted to post what it actually was, since that Win32_DiskDrive class is pretty big and has a lot of stuff. Also since the above poster wasn’t exactly right on the select statement, i wanted to help.
If you wanted to get a little more detailed information to ensure you’re looking at the right storage provider as well, use this select afterwards.
get-wmiobject Win32_DiskDrive | select name, caption, scsibus, scsilogicalunit | sort-object name | ft -autosize -wrap