VOOZH about

URL: https://www.cdata.com/kb/tech/adobeexperiencemanager-ado-powershell.rst

⇱ Automate Adobe Experience Manager Integration Tasks from PowerShell


Automate Adobe Experience Manager Integration Tasks from PowerShell

👁 Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Are you in search of a quick and easy way to access Adobe Experience Manager data from PowerShell? This article demonstrates how to utilize the Adobe Experience Manager Cmdlets for tasks like connecting to Adobe Experience Manager data, automating operations, downloading data, and more.

The CData Cmdlets for Adobe Experience Manager are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Adobe Experience Manager.

PowerShell Cmdlets or ADO.NET Provider?

The Cmdlets are not only a PowerShell interface to Adobe Experience Manager, but also an SQL interface; this tutorial shows how to use both to retrieve Adobe Experience Manager data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Adobe Experience Manager. To access Adobe Experience Manager data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Adobe Experience Manager.

Once you have acquired the necessary connection properties, accessing Adobe Experience Manager data in PowerShell can be enabled in three steps.

The driver connects to Adobe Experience Manager (AEM) instances that expose the JCR repository over WebDAV. It supports both on-premises AEM and AEM as a Cloud Service deployments.

To establish a connection, set the following properties:

  • URL: The WebDAV-enabled JCR server URL.
    • AEM as a Cloud Service: https://author-pXXXXX-eXXXXX.adobeaemcloud.com/crx/server
    • Local development: http://localhost:4502/crx/server
  • User: Your AEM username.
  • Password: Your AEM password.

Note: Tables are dynamically generated based on the JCR repository structure. Ensure that the configured user has sufficient permissions to access the required content paths in the AEM repository.

PowerShell

  1. Install the module:

    Install-Module AdobeExperienceManagerCmdlets
  2. Connect:

    $adobeexperiencemanager = Connect-AdobeExperienceManager -URL "$URL" -User "$User" -Password "$Password"
    
  3. Search for and retrieve data:

    $name = "example"
    $content = Select-AdobeExperienceManager -Connection $adobeexperiencemanager -Table "Content" -Where "Name = `'$Name`'"
    $content
    

    You can also use the Invoke-AdobeExperienceManager cmdlet to execute SQL commands:

    $content = Invoke-AdobeExperienceManager -Connection $adobeexperiencemanager -Query 'SELECT * FROM Content WHERE Name = @Name' -Params @{'@Name'='example'}
    

ADO.NET

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Adobe Experience Manager\lib\System.Data.CData.AdobeExperienceManager.dll")
     
  2. Connect to Adobe Experience Manager:

     
    $conn= New-Object System.Data.CData.AdobeExperienceManager.AdobeExperienceManagerConnection("URL=https://author-p12345-e67890.adobeaemcloud.com/crx/server;User=admin;Password=admin;")
    $conn.Open()
    
  3. Instantiate the AdobeExperienceManagerDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Name from Content"
    
    $da= New-Object System.Data.CData.AdobeExperienceManager.AdobeExperienceManagerDataAdapter($sql, $conn)
    $dt= New-Object System.Data.DataTable
    $da.Fill($dt)
    
    $dt.Rows | foreach {
    	Write-Host $_.id $_.name
    }
     
CodeProject

Ready to get started?

Download a free trial of the Adobe Experience Manager Data Provider to get started:

 Download Now

Learn more:

👁 Adobe Experience Manager Icon
Adobe Experience Manager ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Adobe Experience Manager.