Disconnect-IscsiTarget insists on interactive mode..

Hi

I am trying to automate disconnecting using  Disconnect-IscsiTarget but it insists on prompting me for confirmation. Not so good when you want to use this from Orchestrator.

The interaktiv behaviour:

PS C:\Users\Administrator\Desktop\hitkit> .\disconnect_eql_volume.ps1

Successfully connected to the group 'DELL-EQL-S3G-T05-GRP01'

Confirm

Are you sure you want to perform this action?

Performing operation '' on Target ''.

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

The script:

#Dell part

Import-Module 'C:\Program Files\EqualLogic\bin\EqlPSTools.dll'

Connect-EqlGroup -GroupAddress $groupAddress -GroupName $groupName -UserName $user -Password $password

$iTarget = (Get-EqlVolume -VolumeName $volumeName).ISCSITargetName

#Microsoft part

Disconnect-IscsiTarget -NodeAddress $iTarget

How may we run this command without user interaction?

I have tried this:

write-output 'Y' | Disconnect-IscsiTarget -NodeAddress $iTarget -PassThru

but get this error:

Disconnect-IscsiTarget : The input object cannot be bound to any parameters for the command either because the command

does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

I have also tried disconnecting all sessions beforehand inlcluding persistent connection.

I have also played with the confirm switch for the  Disconnect-IscsiTarget  but it gives the same interactive behaviour. I would believe that with the confirm switch, the default behavior would be non-interactive.

The disk is offline in Windows diskmanager and connected as a iscsitarget.

Best Regards,

Erik

April 16th, 2013 6:18pm

I see you say you've played around with the -confirm switch and this may be a no-brainer, but since I have no opportunity to test at the moment I'm just going to throw it out here.

Have you tried passing the -confirm parameter in the format -confirm:$false? If not, try passing it like this:

Disconnect-IscsiTarget -NodeAddress $iTarget -confirm:$false

Free Windows Admin Tool Kit Click here and download it now
April 16th, 2013 6:31pm

can you pass -confirm to this? default confirm is usually yes

write-output 'Y' | Disconnect-IscsiTarget -NodeAddress $iTarget -PassThru -confirm


  • Edited by ImMax Tuesday, April 16, 2013 6:58 PM
April 16th, 2013 6:57pm

By using "-Confirm:$false" the function returns without error messages but the target is not removed. The target is only removed when I answer yes to the dialog.

Erik 

Free Windows Admin Tool Kit Click here and download it now
April 18th, 2013 3:46pm

can you pass -confirm to this? default confirm is usually yes

write-output 'Y' | Disconnect-IscsiTarget -NodeAddress $iTarget -PassThru -confirm


No change to the behaviour.

April 18th, 2013 3:48pm

Hi,

Based on my research, -confirm parameter does not accept pipeline input:

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

And the default value of it is false.

For more details:

http://technet.microsoft.com/en-us/library/hh826108(v=wps.620).aspx

Regards,

Yan Li

 

If you have any feedback on our support, please click here .

Free Windows Admin Tool Kit Click here and download it now
April 22nd, 2013 5:42am

Hi,

Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.

 

If you have any feedback on our support, please click here .

 

April 24th, 2013 5:33am

Try this out:

  iscsicli SessionList | select-string "Session Id"

If you have a single connection and a single session, you can use 'iscsicli' do disconnect the session:

  $session=$(iscsicli sessionlist | select-string "Session Id" | Out-String).split("{:}")[1].TrimStart()

  iscsicli LogoutTarget $session

I hope this help.

Free Windows Admin Tool Kit Click here and download it now
December 10th, 2014 7:45pm

Hi,

Based on my research, -confirm parameter does not accept pipeline input:

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

And the default value of it is false.

For more details:

http://technet.microsoft.com/en-us/library/hh826108(v=wps.620).aspx

Regards,

Yan Li

 

If you have any feedback on our support, please click here .

June 30th, 2015 1:51pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics