brianlala / AutoSPInstaller

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

Provisioning doesn't work when myhost on non-standard port #76

Open acou1304 opened 3 years ago

acou1304 commented 3 years ago

I've seen this error reported a couple of years ago, where on line 3298 of AutoSPInstallerModule.psm1 it throws an exception because the $mySiteAppPool variable is not primed. Fundamentally, (apart from the missing variable) the script is looking to see if the MySite web application exists. The problem is that it doesn't append the ':' at the end if the port number is not 80 or 443. $getSPWebApplication = Get-SPWebApplication -Identity $mySiteURL -ErrorAction SilentlyContinue If ($null -eq $getSPWebApplication -and ($mySiteWebApp)) { Write-Host -ForegroundColor White " - Creating Web App "$mySiteName"..." New-SPWebApplication -Name $mySiteName -ApplicationPoolAccount $($mySiteAppPoolAcct.username) -ApplicationPool $mySiteAppPool -DatabaseServer $mySiteDBServer -DatabaseName $mySiteDB -Url $mySiteURL -Port $mySitePort -SecureSocketsLayer:$mySiteUseSSL @hostHeaderSwitch @pathSwitch @databaseCredentialsParameter | Out-Null }

Line 3294 will fail because the URL passed in is something like http://mysite instead of http://mysite:1280 (where the port number is 1280 for example).

VACoder commented 1 month ago

This is an issue in June 2024 as well except that it fails on 3635. MySiteHost is set to 8081 in my setup script:

Creating Web App "MySite Host"... New-SPWebApplication : Cannot bind argument to parameter 'ApplicationPool' because it is null. At C:\Temp\AutoSPInstaller\SP\Automation\AutoSPInstallerModule.psm1:3635 char:132