UNSOLVED

TBoneMNP

updated

13 years ago

T

TBoneMNP

41 Posts

0

14533

April 3rd, 2014 15:00

Powershell Variable to iscsicli

Trying to use Powershell to pass a variable for iscsicli to use. 

$iscsitarget = Get-EqlVolume -VolumeName BKCLONE | select iSCSITargetName

$iscsitarget = the proper iqn of the volume I'm trying to connect.

When I try to use this variable with iscsicli as such: 

iscsicli qlogintarget $iscsitarget

I get this error: The iSCSI name specified contains invalid characters or is too long.

If I convert this variable to a temporary system variable, and echo it, there are characters in the string which are not part of the actual IQN, causing the name to be invalid.

Example: $env:eqltarget = $iscsitarget

echo $env:eqltarget

This is the result:

@{iSCSITargetName=iqn.2001-05.com.equallogic:0-8a0906-67f19c90c-7e447fe11f8533c9-user1bkclone}

The question now is, how do I remove those illegal characters and iSCSITargetName so I can present this variable properly so iscsicli will understand it?

This variable when passed to powershell just shows the iqn of the volume.

Thanks in advance!

No Responses