Windows Server 2008 R2 and 2008 R2 (Service Pack 1)
Windows Server 2008 R2 has a built in utility called iscsicli.exe. You can use this tool to show the IQNs.
C:\> iscsicli.exe ListTargets
Microsoft iSCSI Initiator Version 6.0 Build 6000
Target List:
iqn.2001-05.com.example:x-xxxxxx-xxxxxxxxx-xxxxxxxxxxx
The operation completed successfully.
You can also use PowerShell to query the WMI Object Class.
PS C:\> (Get-WmiObject -Namespace root\wmi -Class MSiSCSIInitiator_MethodClass).iSCSINodeName iqn.1991-05.com.microsoft:myserver.local
Windows Server 2012, 2012 R2, 2016 and 2019
The
Get-InitiatorPort PowerShell cmdlet also lists and iSCSI IQNs as well as WWNs.
PS C:\> Get-InitiatorPort
InstanceName NodeAddress PortAddress ConnectionType
------------ ----------- ----------- --------------
PCI\VEN_1077&DEV_2031&SUBSYS_02491077&REV_02\4&29b7c6e4&0&0018_0 2000000e1e1f6bc0 2100000e1e1f6bc0 Fibre Channel
PCI\VEN_1077&DEV_2031&SUBSYS_02491077&REV_02\4&29b7c6e4&0&0118_0 2000000e1e1f6bc1 2100000e1e1f6bc1 Fibre Channel
ROOT\ISCSIPRT\0000_0 iqn.1991-05.com.microsoft:sn1-r720-e04-07.ale.local ISCSI ANY PORT iSCSI