Creating BCS Service Application Using PowerShell Script In SharePoint 2013

This blog will help you learn how to create a Microsoft Business Connectivity Services service application in SharePoint Server 2013.
 
SharePoint

SharePoint 2013 is a collaboration environment that organizations of all sizes can use to increase the efficiency of business processes.

BCS
 
  • Business Connectivity Services is a centralized infrastructure in SharePoint 2013/2016 that supports integrated data solutions.BCS will help you to present the data in an external list.
  • External lists look and feel like regular SharePoint lists, except that they can only display external data.If you want to integrate external data alongside other data in a list or library, you would use an external data column.
  • External data may be in a database and it is accessed by using the out-of-the-box Business Connectivity Services connector for that database.
  • BCS can also connect to data that is available through a web service.
Create a BCS using OOTB
 
If you want to create a BCS using OOTB method, open the SharePoint Central Administration website with a farm administrator account.
 
Under Application Management, select "Manage service applications".
 
At last, you have to select "New" and then click "Business Data Connectivity Service".

Powershell Method
  • Open your SharePoint Management Shell.
  • Copy the below code.
  • Run this one.
     
    1. Add - PsSnapin Microsoft.SharePoint.PowerShell - ErrorAction SilentlyContinue  
    2. # Required Details / Settings  
    3. $ServiceName = "BCS Service"  
    4. $ServiceProxyName = "BCS Proxy"  
    5. $AppPoolAccount = "SPDEV\gowtham"  
    6. $AppPoolName = "SharePoint App Pool"  
    7. $DatabaseServer = "bcs2013"  
    8. $DatabaseName = "BCS"  
    9. Write - Host - ForegroundColor Yellow "Checking if Application Pool Accounts exists"  
    10. $AppPoolAccount = Get - SPManagedAccount - Identity $AppPoolAccount - EA 0  
    11. if ($AppPoolAccount - eq $null)  
    12. {  
    13.     $AppPoolCred = Get - Credential $AppPoolAccount  
    14.     $AppPoolAccount = New - SPManagedAccount - Credential $AppPoolCred - EA 0  
    15. }  
    16. $AppPool = Get - SPServiceApplicationPool - Identity $AppPoolName - ErrorAction SilentlyContinue  
    17. if (!$AppPool)   
    18. {  
    19.     Write - Host - ForegroundColor Green "Creating Application Pool"  
    20.     $AppPool = New - SPServiceApplicationPool - Name $AppPoolName - Account $AppPoolAccount - Verbose  
    21. }  
    22. Write - Host - ForegroundColor Yellow "Checking if BCS Service Application exists"  
    23. $ServiceApplication = Get - SPServiceApplication - Name $ServiceName - ErrorAction SilentlyContinue  
    24. if (!$ServiceApplication)  
    25. {  
    26.     Write - Host - ForegroundColor Green "Creating BCS Service Application"  
    27.     $ServiceApplication = New - SPBusinessDataCatalogServiceApplication– ApplicationPool $AppPool– DatabaseName $DatabaseName– DatabaseServer $DatabaseServer– Name $ServiceName  
    28. }  
    29. Write - Host - ForegroundColor Yellow "Starting the BCS Service"  
    30. $ServiceInstance = Get - SPServiceInstance | Where - Object   
    31. {  
    32.     $_.TypeName - like "*Business*"  
    33. }  
    34. Start - SPServiceInstance $ServiceInstance  
    35. Write - Host - ForegroundColor Green "BCS Services Created Succesfully."  
Conclusion
 
The above code will create a BCS using OOTB method.