Powershell command Connect-IscsiTarget give an error when using CHAP authentication
Hi,
I have an iSCSI Target located on a NAS. The IQN is "iqn.2004-04.com.qnap:ts-869pro:iscsi.datastore15qnap.dd1020". CHAP Authentication is set up.
On a Windows machine I am able to connect to the LUN with the iSCSI Initiator GUI.
However, when I try to connect using Powershell, I get one of two error message "Connect-IscsiTarget : The target name is not found or is marked as hidden from login."
or "Connect-IscsiTarget : Target Error."
The commands I issued were as follows:
New-IscsiTargetPortal -TargetPortalAddress "192.168.0.245"
Connect-IscsiTarget -NodeAddress "iqn.2004-04.com.qnap:ts-869pro:iscsi.datastore15qnap.dd1020" -AuthenticationType OneWayCHAP -ChapUsername "datastore15qnap" -ChapSecret "ea7tHe^W@re5" -IsPersistent:$false
If I remove the CHAP authentication from the iSCSI Target, I can connect with the following PowerShell command:
Connect-IscsiTarget -NodeAddress "iqn.2004-04.com.qnap:ts-869pro:iscsi.datastore15qnap.dd1020" -IsPersistent:$false
What is wrong with the PowerShell command when using authentication?
Regards,