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:

ss_iscsi_gettargetportal

You might therefore expect that you could remove this Target Portal with the command:

Unfortunately this won’t work:

ss_iscsi_removetargetportal1

And neither does this:

ss_iscsi_removetargetportal2

What you actually have to do is specify both the Target Portal Address and the Initiator Portal Address when deleting an iSCSI Target Portal:

ss_iscsi_removetargetportalcorrect

Over and out.