Automate Alfresco Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Alfresco ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Alfresco data including Files, Folders, Users, Groups, Sites, Tags, and more!

Are you looking for a quick and easy way to access Alfresco data from PowerShell? We show how to use the Cmdlets for Alfresco and the CData ADO.NET Provider for Alfresco to connect to Alfresco data and synchronize, automate, download, and more.

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing Alfresco data in PowerShell consists of three basic steps.

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, you should supply for InstanceUrl.


  1. Install the module:

    Install-Module AlfrescoCmdlets
  2. Connect:

    $alfresco = Connect-Alfresco -User "$User" -Password "$Password" -Format "$Format" -InstanceUrl "$InstanceUrl"
  3. Search for and retrieve data:

    $column2 = "MyFilter" $alfresco = Select-Alfresco -Connection $alfresco -Table "Alfresco" -Where "Column2 = `'$Column2`'" $alfresco

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

    $alfresco = Invoke-Alfresco -Connection $alfresco -Query 'SELECT * FROM Alfresco WHERE Column2 = @Column2' -Params @{'@Column2'='MyFilter'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Alfresco.AlfrescoConnection("User=MyUsername; Password=MyPassword; Format=Solr;;") $conn.Open()
  3. Instantiate the AlfrescoDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT DBID, Column1 from Alfresco" $da= New-Object System.Data.CData.Alfresco.AlfrescoDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.dbid $_.column1 }