Here a small script to provision the Business Data Connectivity Service Application-without ugly GUID in the database name.
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Settings
$ServiceName = "BDC Service"
$ServiceProxyName = "BDC Proxy"
$AppPoolAccount = "demo\spservices"
$AppPoolName = "SharePoint Services App Pool"
$DatabaseServer = "sp2013"
$DatabaseName = "SP2013 BDC"
Write-Host -ForegroundColor Yellow "Checking if Application Pool Accounts exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -EA 0
if($AppPoolAccount -eq $null)
{
Write-Host "Please supply the password for the Service Account..."
$AppPoolCred = Get-Credential $AppPoolAccount
$AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCred -EA 0
}
Write-Host -ForegroundColor Yellow "Checking wether the Application Pool exists"
$AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
if (!$AppPool)
{
Write-Host -ForegroundColor Green "Creating Application Pool"
$AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount -Verbose
}
Write-Host -ForegroundColor Yellow "Checking if BDC Service Application exists"
$ServiceApplication = Get-SPServiceApplication -Name $ServiceName -ErrorAction SilentlyContinue
if (!$ServiceApplication)
{
Write-Host -ForegroundColor Green "Creating BDC Service Application"
$ServiceApplication = New-SPBusinessDataCatalogServiceApplication –ApplicationPool $AppPool –DatabaseName $DatabaseName –DatabaseServer $DatabaseServer –Name $ServiceName
}
Write-Host -ForegroundColor Yellow "Starting the BDC Service"
$ServiceInstance = Get-SPServiceInstance | Where-Object { $_.TypeName -like "*Business*" }
Start-SPServiceInstance $ServiceInstance
Write-Host -ForegroundColor Green "Done - BDC Service is up and running."
Its basically an extended version of my Provision Search Service Application script, just a little cleaned-up. During the creation (some would say copy & paste) I wondered why the proxy is created automatically – at first I had two proxies.
Pictures
Pictures or it did not happen!
References
- http://technet.microsoft.com/en-us/library/ff607899.aspx – Create the BDC Service Application
- http://technet.microsoft.com/en-us/library/ff607952.aspx – Create the Proxy
Questions / Issues ?
If I missed a thing or if you have questions – go for it!
Share this post
Twitter
Facebook
LinkedIn
Email