Line 2637 of AutoSPInstallerfunctions.ps1
Line text:
```
Write-Host -ForegroundColor White " - Creating Site Collection `"$siteURL`"..."
$site = New-SPSite -Url $siteURL -OwnerAlias $ownerAlias -SecondaryOwner $env:USERDOMAIN\$env:USERNAME -ContentDatabase $siteDatabase -Description $siteCollectionName -Name $siteCollectionName -Language $LCID @templateSwitch @hostHeaderWebAppSwitch -ErrorAction Stop
```
Should check if site already exists, otherwise the script halts and fails to configure the remaining actions.
the following should successfully check for existing site (replace the above two lines)
```
$siteExists = Get-SPSite $siteURL -ErrorAction SilentlyContinue
if (!$siteExists)
{
Write-Host -ForegroundColor White " - Creating Site Collection `"$siteURL`"..."
$site = New-SPSite -Url $siteURL -OwnerAlias $ownerAlias -SecondaryOwner $env:USERDOMAIN\$env:USERNAME -ContentDatabase $siteDatabase -Description $siteCollectionName -Name $siteCollectionName -Language $LCID @templateSwitch @hostHeaderWebAppSwitch -ErrorAction Stop
} else {
Write-Host -ForegroundColor White " - Site Collection already exists at `"$siteURL`"..."
$site = $siteExists
}
```
Attached is the updated script.
Line text:
```
Write-Host -ForegroundColor White " - Creating Site Collection `"$siteURL`"..."
$site = New-SPSite -Url $siteURL -OwnerAlias $ownerAlias -SecondaryOwner $env:USERDOMAIN\$env:USERNAME -ContentDatabase $siteDatabase -Description $siteCollectionName -Name $siteCollectionName -Language $LCID @templateSwitch @hostHeaderWebAppSwitch -ErrorAction Stop
```
Should check if site already exists, otherwise the script halts and fails to configure the remaining actions.
the following should successfully check for existing site (replace the above two lines)
```
$siteExists = Get-SPSite $siteURL -ErrorAction SilentlyContinue
if (!$siteExists)
{
Write-Host -ForegroundColor White " - Creating Site Collection `"$siteURL`"..."
$site = New-SPSite -Url $siteURL -OwnerAlias $ownerAlias -SecondaryOwner $env:USERDOMAIN\$env:USERNAME -ContentDatabase $siteDatabase -Description $siteCollectionName -Name $siteCollectionName -Language $LCID @templateSwitch @hostHeaderWebAppSwitch -ErrorAction Stop
} else {
Write-Host -ForegroundColor White " - Site Collection already exists at `"$siteURL`"..."
$site = $siteExists
}
```
Attached is the updated script.