Is there a way to find out iSCSI initiator name on windows using CLI? It will be better if there is way to find it out using Powershell.
I have already looked at iscsicli.exe but it doesn't give me the information that i am looking for.
Is there a way to find out iSCSI initiator name on windows using CLI? It will be better if there is way to find it out using Powershell.
I have already looked at iscsicli.exe but it doesn't give me the information that i am looking for.
Possibly it requires a newer version of Powershell but...
(Get-InitiatorPort).NodeAddress
That will give you the Initiator name.
From Powershell, you can get it natively with Get-WmiObject:
PS C:\Windows\system32> (Get-WmiObject -Namespace root\wmi -Class MSiSCSIInitiator_MethodClass).iSCSINodeName
iqn.1991-05.com.microsoft:mandrews-pc.local
You can get it in a roundabout way from iscsicli.exe, but not in a format that's too helpful. When you run iscsicli.exe interactively, it displays the initiator IQN in the prompt:
C:\Windows\system32>iscsicli
Microsoft iSCSI Initiator Version 6.1 Build 7601
[iqn.1991-05.com.microsoft:your-pc.local] Enter command or ^C to exit
So if you've got powershell, that's the way to go.
If you do not have powershell and you want get the iqn name through script, you can send the
cmd = "echo getiqn | iscsicli.exe". ( 'getiqn' is just a invalid input to iscsicli.exe to make it fail)
Now you have the iqn name in the cmd output.