Using DISKPART
command line utility, I can get something called a "Location path" which appears to give me what I need, you can view this by using the command detail disk
after selecting one of your disks in diskpart
.
It appears I can get this information programatically via this class: MSFT_Disk
I am unsure about how to get an instance of this class. I have a few examples of using a ManagementObjectSearcher
for WMI
classes but that method is not working for me, I am also unsure of MSFT_Disk
's availability in Windows 7 as the page mentions that this is for Windows 8.
Does anyone know of a good way to get SATA channel information or the "location path" of a disk?
If you want to get the location path, SetupDiGetDeviceRegistryProperty is the function you're looking for. Set the property value to
SPDRP_LOCATION_INFORMATION
.I'm assuming you already know how to enumerate devices to get the
DeviceInfoSet
andDeviceInfoData
.