Powershell command Connect-IscsiTarget give an error when using CHAP authentication

Georges Carraha 0 Reputation points
2025-01-10T02:56:00.3533333+00:00

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,

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,609 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.