AutoSPInstaller
AutoSPInstaller copied to clipboard
AutoSPInstallerModule.psm1 - Line 2882 - Fails to get existing web app for HNSC on multiple servers
- 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.
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
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?
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.
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 [email protected] Sent: Tuesday, March 31, 2020 12:09:03 PM To: brianlala/AutoSPInstaller [email protected] Cc: Subscribed [email protected] 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.