Remove an iSCSI Target Portal with PowerShell
I ran into a small problem with removing iSCSI Target Portals using PowerShell the other day and thought it might be worth documenting.
Pretend you have an iSCSI Target Portal configured with a Target Portal Address of 192.168.129.24:
You might therefore expect that you could remove this Target Portal with the command:
Remove-IscsiTargetPortal -TargetPortalAddress 192.168.129.24
Unfortunately this won’t work:
And neither does this:
What you actually have to do is specify both the Target Portal Address and the Initiator Portal Address when deleting an iSCSI Target Portal:
Remove-IscsiTargetPortal -TargetPortalAddress 192.168.129.24 -InitiatorPortalAddress 192.168.129.30
Over and out.