To delete the ECP virtual directory of your Exchange server and re-create it from scratch, you can use the below to get the identity of the virtual directory.
Use this to remove the virtual directory in question
Remove-EcpVirtualDirectory -identity "MYSERVER\ecp (Exchange Back End)"
Create the new virtual directory use the below
New-EcpVirtualDirectory -externalurl "https://outlook.mydomain.com/ecp" -internalurl "https://myserver/ecp" -Server "myserver.mydomain.local"