Ready to get started?

Learn more about the Alfresco PowerShell Cmdlets or download a free trial:

Download Now

Pipe Alfresco Data to CSV in PowerShell

Use standard PowerShell cmdlets to access Alfresco tables.

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

Creating a Connection to Your Alfresco Data

To connect to Alfresco, the following connection properties must be supplied: User, Password, and InstanceUrl. User and Password correspond to the login credentials that you use to access Alfresco in a web browser. InstanceUrl corresponds to the Alfresco instance you will be querying. For instance, if you expect your queries to hit https://search-demo.dev.alfresco.me/alfresco/api/-default-/public/search/versions/1/sql, you should supply search-demo.dev.alfresco.me for InstanceUrl.

$conn = Connect-Alfresco  -User "$User" -Password "$Password" -Format "$Format" -InstanceUrl "$InstanceUrl"

Selecting Data

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

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

You will notice that we piped the results from Select-Alfresco 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.