brianlala / AutoSPInstaller

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

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

Open SPDEVGUY opened 4 years ago

SPDEVGUY commented 4 years ago
  • 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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

What is your scenario? I build multi server environment over the weekend but have not seen this issue. Any thing different may be ?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Brian Lalancette notifications@github.com Sent: Tuesday, March 31, 2020 12:09:03 PM To: brianlala/AutoSPInstaller AutoSPInstaller@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [brianlala/AutoSPInstaller] AutoSPInstallerModule.psm1 - Line 2882 - Fails to get existing web app for HNSC on multiple servers (#59)

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/brianlala/AutoSPInstaller/issues/59#issuecomment-606724105, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHLKYY2DTY4GOXQQ4GFXB4TRKIIR7ANCNFSM4LWEUVAQ.