brianlala / AutoSPInstaller

Automated SharePoint 2010/2013/2016/2019/SE PowerShell-based installation script.
https://autospinstaller.com
MIT License
171 stars 81 forks source link

Fixes AccessDenied error on site collection creation #19

Open lkrn opened 6 years ago

lkrn commented 6 years ago

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).

brianlala commented 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.

lkrn commented 6 years ago

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.

lkrn commented 6 years ago

Added check for http binding for website with ID=1. Removed useless Name check due to potential issue with localized versions of IIS.