Quantcast
Channel: AutoSPInstaller
Viewing all articles
Browse latest Browse all 2279

Edited Issue: Separate Content Database Per Site Collection [20286]

$
0
0
As per a Microsoft PFE recommendation I've made it a standard to have a separate content database for every site collection, but I found that the script does not allow for separate content databases at the site collection level. All site collections go to the same content database associated with the application. I did a little research and then made a customization to the script to allow me to specify a content database (or not) in the XML and the script creates the content database for the site collection. If a database is not specified it uses the application's content database. There is only one problem with the change I've made and I couldn't find a way to resolve it. I do not know how to check for the existance of the content database before creating it. It's not a problem in my environment as every site collection has it's own content database, but if the script fails in the middle and I have to restart it, it gets messy. Also, if anyone else were to use it to assign a few site collections to the same content database, it's going to error each time it tries to create an already existing content database. I'm new to SharePoint and really new to PowerShell, and Google failed to turn up a method for checking for the existance of a content database. The code I added/changed to the CreateWebApp function (inside AutoSPInstallerFunctions.ps1) is below, followed by an example XML: if ($SiteCollection.databaseName -eq $null) { $SiteCollectionDB = $database } Else { $SiteCollectionDB = $DBPrefix+$SiteCollection.databaseName Write-Host -ForegroundColor White " - Creating new content database: `"$SiteCollectionDB`"..." New-SPContentDatabase -Name $SiteCollectionDB -WebApplication $WebAppName } # If a template has been pre-specified, use it when creating the Portal site collection; otherwise, leave it blank so we can select one when the portal first loads If (($Template -ne $null) -and ($Template -ne "")) { $Site = New-SPSite -Url $SiteURL -OwnerAlias $OwnerAlias -SecondaryOwnerAlias $SecondOwnerAlias -ContentDatabase $SiteCollectionDB -Description $SiteCollectionName -Name $SiteCollectionName -Language $LCID -Template $Template -ErrorAction Stop } Else { $Site = New-SPSite -Url $SiteURL -OwnerAlias $OwnerAlias -SecondaryOwnerAlias $SecondOwnerAlias -ContentDatabase $SiteCollectionDB -Description $SiteCollectionName -Name $SiteCollectionName -Language $LCID -ErrorAction Stop } <SiteCollection siteUrl="http://ecm.rmon.pri/Contracts" owner="DOMAIN\Farm_admin" secondowner="DOMAIN\someuser" name="Contracts ECM" description="Corporate Contracts Management" SearchUrl="http://nrsherpa.rmon.pri/search" databaseName="ECM_Contracts_Content" CustomTemplate="false" Template="CMSPUBLISHING#0" LCID="1033" Locale="en-us" Time24="false"></SiteCollection>

Viewing all articles
Browse latest Browse all 2279

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>