有没有办法使用 CLI 在 Windows 上找出 iSCSI 启动器名称?如果有办法使用Powershell找到它会更好。
我已经查看了 iscsicli.exe,但它没有提供我正在寻找的信息。
有没有办法使用 CLI 在 Windows 上找出 iSCSI 启动器名称?如果有办法使用Powershell找到它会更好。
我已经查看了 iscsicli.exe,但它没有提供我正在寻找的信息。
在 Powershell 中,您可以使用 Get-WmiObject 本地获取它:
PS C:\Windows\system32> (Get-WmiObject -Namespace root\wmi -Class MSiSCSIInitiator_MethodClass).iSCSINodeName
iqn.1991-05.com.microsoft:mandrews-pc.local
您可以从 iscsicli.exe 以迂回的方式获取它,但不是以一种太有用的格式。当您以交互方式运行 iscsicli.exe 时,它会在提示符中显示启动器 IQN:
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
所以如果你有powershell,那就是要走的路。
可能它需要更新版本的 Powershell 但是......
(Get-InitiatorPort).NodeAddress
这将为您提供启动器名称。
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.