This project has moved and is read-only. For the latest updates, please go here.

Failure during rerun due to site collections already existing

Topics: Feature Requests, Feedback, Support
Jan 15, 2016 at 3:19 AM
I created config and ran scripts from I had a "/" character in my app pool name for the 2nd web app i created (i use the hostname for my app pools and copied the trailing "/"). It happened to be my mysite web app. My intranet web app had already been created with a few site collections in it.

The scripts halted execution. I fixed the issues in the second web app and reran the scripts with the updated config file. Upon running, it errored again, but this time because it detected that the site collections already existed in the first web app.

This is a DEV environment and I was looking to simply recreate the site collections (Remove-SPSite) in the event of a setup run issue. Perhaps a "Recreate if exists" checkbox. Or some sort of hook, perhaps in the FunctionsCustom.ps1?
Jan 15, 2016 at 3:41 AM
investigated... i have trailing slashes in my site collection urls as specified in xml config.

The line that checks if the site collection already exists is not forgiving of this trailing slash:

$getSPSiteCollection = Get-SPSite -Limit ALL | Where-Object {$_.Url -eq $siteURL}

Can I submit a pull request to fix this?

Jan 15, 2016 at 4:15 AM
Perhaps we'll look at having more thorough real-time validation in for illegal (or typically unwanted characters) in both the app pool names as well as the site collection URLs.

My feeling lately is to have do this sort of validation, rather than bloat the script to try to cover every possible scenario. Regardless, thanks for raising this.

Jan 15, 2016 at 4:20 AM
added a fix for the trailing slash in the site colleciton urls:

included a comment to address app pool names.

Not much bloat in this.

I'd push for having in the script to fix manual or find/replace edits of raw xml files.

XSD overkill ?