You can use esxcli iscsi session to remove iSCSI sessions.

Specify one of the options listed in Connection Options for vCLI Host Management Commands in place of <conn_options>.

  • Remove sessions from the current software iSCSI or dependent hardware iSCSI configuration at the adapter level.
    esxcli <conn_options> iscsi session remove --adapter=<iscsi_adapter>
    The following example applies custom values.
    esxcli iscsi session remove --adapter=vmhba36
  • Remove sessions from the current software iSCSI or dependent hardware iSCSI configuration at the target level.
    esxcli <conn_options> iscsi session remove --name=<iqn> --adapter=<iscsi_adapter>
    The following example applies custom values.
    esxcli <conn_options> iscsi session remove --name=iqn.xxx --adapter=vmhba38
  • Remove sessions from the current software iSCSI or dependent hardware iSCSI configuration with target and session ID.
    esxcli <conn_options> iscsi session remove --name=<iqn.xxxx> --isid=<session id> --adapter=<iscsi_adapter>
    iqn.xxxx is the target IQN, which you can determine by listing all sessions. session_id is the session's iSCSI ID. The following example applies custom values.
    esxcli --config /host-config-file iscsi session remove --name=iqn.xxx --session='00:02:3d:01:00:01' --adapter=vmhba36