Création des bases de configuration et d’administration centrale SharePoint

Voici un script PowerShell permettant de garder le contrôle sur le nommage des bases de données de configuration et de l’admin centrale SharePoint.a

## Settings you may want to change ##
$err = $null
Write-Host “Please specify the Farm Service credentials”
$FarmCredential    = Get-Credential “DOMAIN\svc-sps13-farm”
$DBServer          = Read-Host -Prompt “Please enter the name of your database server”
$DBSPConfigName    = Read-Host -Prompt “Please enter the name of your SharePoint Configuration database”
$DBContAdminName   = Read-Host -Prompt “Please enter the name of your Admin Content database”
$Passphrase        = Read-Host -Prompt “Please enter the farm passphrase (optional)” -AsSecureString
if ([String]::IsNullOrEmpty($FarmCredential))
{
Write-Error “You must enter a Farm Administrator’s user name and password”
return
}
if ([String]::IsNullOrEmpty($DBServer))
{
Write-Error “You must enter a database server”
return
}
if ([String]::IsNullOrEmpty($DBSPConfigName))
{
Write-Error “You must enter a SharePoint Configuration database”
return
}
if ([String]::IsNullOrEmpty($DBContAdminName))
{
Write-Error “You must enter an Admin Content database”
return
}
if ($Passphrase.Length -eq 0)
{
Write-Warning “You didn’t enter a farm passphrase, using the Farm Administrator’s password instead”
$Passphrase = $FarmCredential.Password
return
}

New-SPConfigurationDatabase -DatabaseName $DBSPConfigName -DatabaseServer $DBServer -AdministrationContentDatabaseName $DBContAdminName -FarmCredentials $FarmCredential -Passphrase (ConvertTo-SecureString $Passphrase -AsPlainText -force) -ErrorVariable err