Home > Administration, Business Data Connectivity, PowerShell, SharePoint 2010 > SharePoint: Deploying a BDC model via PowerShell

SharePoint: Deploying a BDC model via PowerShell

    In SharePoint 2010 a BDC model can be easily deployed using PowerShell. Launch SharePoint 2010 Management Shell (click on Start, then All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Management Shell) and execute the following script:

$metaStore = Get-SPBusinessDataCatalogMetadataObject
                -BdcObjectType "Catalog" -ServiceContext "http://yourWebAppUrl"
Import-SPBusinessDataCatalogModel
                -Path "c:\folder\subfolder\yourfile.bdcm" -Identity $metaStore -Force

Note: here command line parameters are wrapped to the next lines for readability only. In SharePoint 2010 Management Shell, each command and its parameters should be in the same line.

The first command, Get-SPBusinessDataCatalogMetadataObject, returns and saves in the $metaStore variable a Catalog metadata object relevant to your web application accessible through the url http://yourWebAppUrl. The second command, Import-SPBusinessDataCatalogModel, imports a Business Data Connectivity Model defined in a file, path of which is indicated by the -Path key. The model is to be added to the Catalog referenced by the $metaStore and overwrites the existent version (if any) due to the -Force key.

Despite the -Force key you can get the following error:

Error: Cannot merge contents of LobSystem (External System) with Name 'Products'
as it appears to be different from a preexisting LobSystem in the current load context.

What you need to do in this case is remove the previous version of the model.

 
  1. Eric Halsey
    May 31st, 2012 at 19:46 | #1

    Thanks!

  2. kiquenet
    July 24th, 2014 at 01:26 | #2

    Great.

    What solution about the following error

    Error: Cannot merge contents of LobSystem (External System) with Name ‘Products’
    as it appears to be different from a preexisting LobSystem in the current load context

    Thanks.

  1. July 28th, 2014 at 06:02 | #1
  2. August 10th, 2014 at 11:24 | #2