Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoSPInstallerModule.psm1 - Line 2882 - Fails to get existing web app for HNSC on multiple servers #59

Open
SPDEVGUY opened this issue Mar 29, 2020 · 4 comments

Comments

@SPDEVGUY
Copy link

  • Creating Web App "Portal"
    New-SPWebApplication : The directory C:\inetpub\wwwroot\wss\VirtualDirectories\Portal-443 is already being used by
    another IIS Web Site. Choose a different root directory for your new Web application.
    At C:\InstallScripts\SP\Automation\AutoSPInstallerModule.psm1:2886 char:9
  •     New-SPWebApplication -Name $webAppName -ApplicationPool $appP ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (Microsoft.Share...PWebApplication:SPCmdletNewSPWebApplication) [New-SPWebA
      pplication], ArgumentException
    • FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPWebApplication

Line 2882 - AutoSPInstallerModule.psm1:
$getSPWebApplication = Get-SPWebApplication -Identity $fullUrl -ErrorAction SilentlyContinue

Should be:
$getSPWebApplication = Get-SPWebApplication -Identity $webAppName -ErrorAction SilentlyContinue

This way it will pick up the web application using the name instead of url, which for host named site collections is created using the machine name.

@SPDEVGUY
Copy link
Author

This also affects lines 2917 and 2924:
$wa = Get-SPWebApplication -Identity $fullUrl

should be
$wa = Get-SPWebApplication -Identity $webAppName

Line 2994:
New-SPContentDatabase -Name $siteDatabase -WebApplication (Get-SPWebApplication -Identity $fullUrl

should be:
New-SPContentDatabase -Name $siteDatabase -WebApplication (Get-SPWebApplication -Identity $webAppName

@SPDEVGUY
Copy link
Author

Specified in my installer config is:

    <WebApplication Name="Portal">
        <Type>Portal</Type>
        <ApplicationPool>SharePoint2019.serverfarm.CA</ApplicationPool>
        <Url>http://localhost</Url>

The localhost is being translated in the script to be the server running it. Perhaps this is not the best practice?

@brianlala
Copy link
Owner

It's not best practice to use the server name or http://localhost as a SharePoint URL. Use a real DNS name instead, different from the server name.

@UmrG
Copy link

UmrG commented Mar 31, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants