Open lkrn opened 6 years ago
What about localized versions of IIS? In those cases, is the default web site still called "Default Web Site" ? I believe that's why I originally included the site ID as well.
In those cases, is the default web site still called "Default Web Site" ?
Maybe not, but I'm pretty sure its physicalPath property will still have wwwroot directory no matter which language is used for IIS.
Added check for http binding for website with ID=1. Removed useless Name check due to potential issue with localized versions of IIS.
If there are no IIS sites prior to SharePoint installation (e.g., "Default Web Site" was removed) then "SharePoint Web Services" IIS site will be created with ID = 1. On new site collection creation, Stop-DefaultWebsite function wrongly assumes that IIS site with ID = 1 is the "Default Web Site" and stops it, which results in hard-to-debug issue (AccessDenied as SecurityTokenService is not available anymore). If really needed I can write function to check IIS bindings for site with ID = 1, or at minimum, check if site name is "SharePoint Web Services", but imho it's kind of stupid to stop any site with ID = 1 (what if it's some business app or WebAPI which uses its own port and do not interfere with SP).