Open acou1304 opened 3 years 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
+ CategoryInfo : InvalidData: (:) [New-SPWebApplication], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.SharePoint.PowerShell.SPCmdletN
ewSPWebApplication
Right above the failing new-SPWebApplicatoin command I paste din this information
$mySiteAppPool = "MySites";
$mySitePort = "8081";
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).