Forum Discussion

sidwrites's avatar
sidwrites
Copper Contributor
Mar 23, 2023

Error while Disconnect-IScsiTarget

Hi,

I have a Powershell script that attaches and detaches and Block Storage device.

 

The attachment follows this general sort of procedure:

1. Set-iScsiChapSecret

2. New-IscsiTargetPortal

3. Get-IscsiTargetPortal | Update-IscsiTargetPortal

4. Get-IscsiTarget | ForEach-Object { Connect-IscsiTarget }

5. Get-IscsiSession | ForEach-Object { Register-IscsiSession}

 

The detachment follows this general sort of steps:

1. Get-IscsiSession | ForEach-Object { Unregister-IScsiSession }

2. Get-IscsiTarget | ForEach-Object { Disconnect-IscsiTarget }

3. Get-IScsiTargetPortal | ForEach-Object { Remove-iScsiTargetPortal }

 

I am getting some very strange results. One of it is when I call Disconnect-IscsiTarget I get "The session cannot be logged out since a device on that session is current being used."

But I called the Unregister-IscsiSession and it seemed to work correctly. 

 

Anyone seen this error and how I can fix it/find out more information?

 

Thanks

No RepliesBe the first to reply

Resources