brianlala / AutoSPInstaller

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

Creating new content database for Site Collection errors, if web application URL is non port 80 #1

Open Kofl opened 7 years ago

Kofl commented 7 years ago
 - Creating web applications...
 - Web app "Demo Portal Home" already provisioned.
 - Setting up managed paths for "http://innkdi291dev:2812"
  - Setting up explicit managed path "help" at "http://innkdi291dev:2812" and HNSCs...
 - Done setting up managed paths at "http://innkdi291dev:2812"
 - Granting i:0#.w|SOS\devadmin Full Control to http://innkdi291dev.kd.sos:2812/...
--------------------------------------------------------------
 - Applying object cache accounts to "http://innkdi291dev:2812"...
 - Granting i:0#.w|SOS\sSP16dev-CacheSU Full Control to http://innkdi291dev.kd.sos:2812/...
 - Granting i:0#.w|SOS\sSP16dev-CacheSR Full Read to http://innkdi291dev.kd.sos:2812/...
 - Done applying object cache accounts to "http://innkdi291dev:2812"
 - Checking for Site Collection "http://innkdi291dev:2812"...
 - Creating new content database "VCPSP2016Dev_291dev_PortalHomeSite"...
Get-SPWebApplication : Cannot find an SPWebApplication object with Name, Id, or Url: http://innkdi291dev.

The web application is http://innkdi291dev:2812, the port is not used for Get-SPWebapplication and tries to fetch http://innkdi291dev and errors out.

fix @ AutoSPInstallerFunctions.ps1

Replace: New-SPContentDatabase -Name $siteDatabase -WebApplication (Get-SPWebApplication $webApp.url) | Out-Null

with: New-SPContentDatabase -Name $siteDatabase -WebApplication (Get-SPWebApplication $webAppName) | Out-Null

at line 2906