Pipe Alfresco Data to CSV in PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Alfresco Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to Alfresco data. The Cmdlets allow users to access live Alfresco Files, Folders, Users, Groups, Sites, Tags, etc. - just like working with SQL server.

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.