How to pipe Adobe Target Data to CSV in PowerShell



Use standard PowerShell cmdlets to access Adobe Target tables.

The CData Cmdlets Module for Adobe Target is a standard PowerShell module offering straightforward integration with Adobe Target. Below, you will find examples of using our AdobeTarget Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your Adobe Target Data

To connect to Adobe Target, you must provide the Tenant property along with OAuth connection properties mentioned below. Note that while other connection properties can influence processing behavior, they do not affect the ability to connect.

To determine your Tenant name:

  1. Log in to Adobe Experience. The URL will look similar to: "https://experience.adobe.com/#/@mycompanyname/preferences/general-section".
  2. Extract the value after the "/#/@". In this example, it is "mycompanyname".
  3. Set the Tenant connection property to that value.

User Accounts (OAuth)

You must set AuthScheme to OAuthClient for all user account flows.

Note: Adobe authentication via OAuth requires updating your token every two weeks.

All Applications

CData provides an embedded OAuth application that simplifies OAuth authentication. Alternatively, you can create a custom OAuth application. Review Creating a Custom OAuth App in the Help documentation for more information.

Obtaining the OAuth Access Token

Set the following properties to connect:

  • InitiateOAuth: Set to GETANDREFRESH to automatically perform the OAuth exchange and refresh the OAuthAccessToken as needed.
  • OAuthClientId : Set to the client Id assigned when you registered your app.
  • OAuthClientSecret : Set to the client secret assigned when you registered your app.
  • CallbackURL : Set to the redirect URI defined when you registered your app. For example: https://localhost:3333

With these settings, the provider obtains an access token from Adobe Target, which it uses to request data. The OAuth values are stored in the location specified by OAuthSettingsLocation, ensuring they persist across connections.

$conn = Connect-AdobeTarget  -Tenant "$Tenant"

Selecting Data

Follow the steps below to retrieve data from the Activities table and pipe the result into to a CSV file:

Select-AdobeTarget -Connection $conn -Table Activities | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myActivitiesData.csv -NoTypeInformation

You will notice that we piped the results from Select-AdobeTarget into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.

Ready to get started?

Download a free trial of the Adobe Target Cmdlets to get started:

 Download Now

Learn more:

Adobe Target Icon Adobe Target Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to Adobe Target data. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.