How to delete all the websites hosted in IIS?

1 minute read

You will end up in the situation to delete one or more website instances hosted in the IIS server. I know it’s a frustrating task to delete the sites one by one. I had a situation to delete the bulk number of sites from the dev server and can’t do that boring job of manual deletion. I figure out the way that Microsoft offers to delete the sites from the IIS application configuration file.

Here are steps to delete the website hosted in the IIS server,

  1. Open the below file,     C:\Windows\System32\inetsrv\Config\applicationHost.config

  2. Navigate to <sites> tag and expand it. You can see all the sites hosted in your IIS server

  3. You can remove the particular site which you want to delete from the IIS server by removing the site tag

  4. If you want to delete all the sites then remove all the <site>...</site> tags

  5. Save the applicationHost.config file.

  6. Go to your IIS server and refresh the sites.

Example:

In the below screenshot, the removal of site tag will remove the default site from IIS.

IIS sites in the applicationHost.config file

Leave a comment