SharePoint 2013 : Fonctions PowerShell pour configurer les services additionnels de SharePoint Foundation 2013
Dans la liste des fonctions utilisables dans vos scripts de configuration de ferme SharePoint, voici celle qui permet de configurer les moteurs additionnels de SharePoint Foundation 2013 :
- Activer le service “Usage Health Data Collection”
- Activer le Service “Business Data Connectivity”
- Activer le Service “Secure Store”
Ce script est inspiré des messages de Blogs :
- SharePoint 2013 – Create and Configure the SharePoint 2013 Farm using Powershell
- Powershell- Create the BDC Service Application for SharePoint 2013
[string]$AliasName = "SQLServer.Alias.Used.In.Your.Farm"
[string]$farmAcct = "DOMAIN\SharePointServiceAccount"
[string]$ContentdatabasePrefix = "YourDataBasePrefix_"# ---------------------------------------------------------------------
Function ActivateUsageHealthDataCollection
{
Try
{
Write-Host -ForegroundColor White " --> Configure the SharePoint Foundation Usage Health Data Collection "
[string]$usageSAName = "Usage and Health Data Collection Service"
[string]$stateSAName = "State Service"
[string]$stateServiceDatabaseName = $ContentdatabasePrefix +"SP2013_State"
[string]$UsageServiceDatabaseName = $ContentdatabasePrefix +"SP2013_Usage"
[string]$UsageLogPath = "C:\SPLogs\"Set-SPUsageService -LoggingEnabled 1 -UsageLogLocation $UsageLogPath -UsageLogMaxSpaceGB 2
$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name $usageSAName -DatabaseServer $AliasName -DatabaseName $UsageServiceDatabaseName -UsageService $serviceInstance > $null
$stateServiceDatabase = New-SPStateServiceDatabase -Name $stateServiceDatabaseName
$stateSA = New-SPStateServiceApplication -Name $stateSAName -Database $stateServiceDatabase
New-SPStateServiceApplicationProxy -ServiceApplication $stateSA -Name "$stateSAName - Proxy" -DefaultProxyGroup
}
catch [system.exception]
{
Write-Host -ForegroundColor Yellow " ->> Activate Usage Health Data Collection caught a system exception"
Write-Host -ForegroundColor Red "Exception Message:", $_.Exception.ToString()
}
finally
{
WriteLine
}
}Function ActivateBDCService
{
Try
{
Write-Host -ForegroundColor White " --> Configure the SharePoint Foundation BDC "
[string]$BDCDatabaseName = $ContentdatabasePrefix +"SP2013_BDC_DB"
[string]$BDCApplicationName = "BDC Service Application"
$BDCappPool = Get-SPManagedAccount -Identity $farmAcct
New-SPServiceApplicationPool -Name BDCApplication_AppPool -Account $BDCappPool -Verbose
$saBDCAppPool = Get-SPServiceApplicationPool -Identity BDCApplication_AppPool
$ServiceApplication = New-SPBusinessDataCatalogServiceApplication -Name $BDCApplicationName -ApplicationPool $saBDCAppPool -DatabaseName $BDCDatabaseName -DatabaseServer $AliasName
New-SPBusinessDataCatalogServiceApplicationProxy -Name "$BDCApplicationName - Proxy" -ServiceApplication $ServiceApplication
}
catch [system.exception]
{
Write-Host -ForegroundColor Yellow " ->> Activate BDC caught a system exception"
Write-Host -ForegroundColor Red "Exception Message:", $_.Exception.ToString()
}
finally
{
WriteLine
}
}Function ActivateSecureStoreService
{
Try
{
Write-Host -ForegroundColor White " --> Configure the SharePoint Foundation Secure Store Service "
[string]$SecureStDatabaseName = $ContentdatabasePrefix +"SP2013_SECURE_STORE_DB"
[string]$SecureStApplicationName = "Secure Store Service Application"
$SecureStappPool = Get-SPManagedAccount -Identity $farmAcct
New-SPServiceApplicationPool -Name SecureStApplication_AppPool -Account $SecureStappPool -Verbose
$saSecureStAppPool = Get-SPServiceApplicationPool -Identity SecureStApplication_AppPool$ServiceApplication = New-SPSecureStoreServiceApplication -ApplicationPool $saSecureStAppPool -AuditingEnabled:$false -DatabaseServer $AliasName -DatabaseName $SecureStDatabaseName -Name $SecureStApplicationName
New-SPSecureStoreServiceApplicationProxy -ServiceApplication $ServiceApplication -Name "$SecureStApplicationName - Proxy"
}
catch [system.exception]
{
Write-Host -ForegroundColor Yellow " ->> Activate Activate Secure Store Service caught a system exception"
Write-Host -ForegroundColor Red "Exception Message:", $_.Exception.ToString()
}
finally
{
WriteLine
}
}ActivateUsageHealthDataCollection
ActivateBDCService
ActivateSecureStoreService
Ce script est testé pour du SharePoint Foundation 2013, mais est aussi compatible avec SharePoint Server 2013.
D’autres fonctions viendront alimenter ce script global qui sera publié en fin. L’idée est de pouvoir prendre ces fonctions comme des briques de base pour votre propre solution de déploiement.
Romelard Fabrice [MVP] - MBA Risk Management
Commentaires
Enregistrer un commentaire