IIS: Unable to remove Default SSL-Binding Certificate for Remote Management

After creating an IIS Server in Docker based on the windows core server image, I seem to be running into issues when trying to install a custom certificate for remove management.

The following minimal example Dockerfile can serve to show the issue:

FROM microsoft/windowsservercore
SHELL [“powershell”, “-command”]
#! Install IIS Management Service
RUN Install-WindowsFeature -name Web-Server -IncludeManagementTools
RUN Dism /online /enable-feature /featurename:IIS-ManagementService /all
#!Remove SSL Certificate for Remote Management: Option 1
RUN Import-Module WebAdministration;Remove-Item -Path IIS:\SslBindings\!8172
#!Remove SSL Certificate for Remote Management: Option 2
RUN netsh http delete sslcert ipport=

When trying to remove the existing binding with certificate in order to install a custom certificate, the first option that should normally be available, for example according to This Link,fails with the following error:

Error Option 1

The second option, propagated for instance by This Site fails with the following output:

Error Option 2

SSL Certificate deletion failed, Error: 1
Incorrect function.

What would be a proper way to replace the existing ssl binding?

This has solved my issue: