Search code examples
cmdhttpscertificatessl-certificatenetsh

SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists - How to bound certificate to ipport?


I'm trying to execute this command in CMD:

netsh http add sslcert ipport=0.0.0.0:443 certhash=‎89857a42309423c239f42392384a appid={214124cd-d05b-4309-9af9-13123454a52b}

and got error message:

SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists.

How to add certificate to ipport if the certificate has already been added?


Solution

  • It means that the port has already bounded a certificate. If we want to bound new certificate we need to delete the old one and bound new one.

    1. Check if port has bounded a cert:

      netsh http show sslcert > c:\result.txt

    2. Open the result.txt and search for the port (in my case 443)

    3. Delete the old certificate: netsh http delete sslcert ipport=0.0.0.0:443

    4. Bound new certificate

      netsh http add sslcert ipport=0.0.0.0:443 certhash=‎89857a42309423c239f42392384a appid={214124cd-d05b-4309-9af9-13123454a52b}