I have a series of iSCSI names (initiators) that typically look like this:
iqn.yyyy-mm.naming-authority:unique name
E.g.
iqn.1991-05.com.microsoft:myPC
I would like to programatically map such iSCSI names to their respective IP addresses and/or hostnames - is there a way to do that? Ideally:
- I'd like to obtain the hostname using e.g. CIM-XML/WBEM/SMI-S or a similar protocol that would allow me to perform the mapping in a platform-independent manner;
- I'd like to avoid having to deploy any custom code to the hosts;
- I'd like to avoid having to manually connect to each possible host in the network and check if its iSCSI name matches the one in question.
- Java or C# preferred.
Note that the unique name
part is usually a hostname, but there is no guarantee for that. Alternatively, iSCSI names can use EUI format, e.g.:
eui.0123456789ABCDEF
On Windows, either "iSCSI Initiator" control panel utility or iscsicli.exe
command can be used to retrieve the machine's IQN, so theoretically I could iterate all possible (Windows) hosts and see if the IQN values match; however, this doesn't sound like an optimal solution.
I also dumped all WMI and CIM classes to look for this mapping, but couldn't find it there.
Is there a proper way to do this?
The iSNS protocol was created to handle that task (among others).