I would like to query the broker database from a PowerShell script, but don't know where to start...
from the PS prompt* I manage to load the Tridion.ContentDelivery.Interop.dll
*This is done from a working and configured HttpUpload directory with the right DLLs, JARs and XMLs.
add-type -path .\tridion.contentdelivery.interop.dll
$q = new-object tridion.contentdelivery.dynamiccontent.query
and this results in errors...
So how to query content from the broker database with PS?
2013-10-2 Update: Some additional information after comments
In Java one would use something like:
import com.tridion.broker.querying.Query;
import com.tridion.broker.querying.criteria.Criteria;
import com.tridion.broker.querying.criteria.content.SchemaTitleCriteria;
Criteria criteria = new SchemaTitleCriteria(MY_SCHEMA);
Query query = new Query();
query.setCriteria(criteria);
try {
String[] result = query.executeQuery();
} catch (StorageException e) { ... }
In PowerShell one would use something like this to call Oracle functionality:
add-type -path .\Oracle.DataAccess.dll
$conn = new-object oracle.dataaccess.client.oracleconnection("Data Source=...; User Id=...; Password=...");
$conn.open()
Now my challenge is not to do something else and write C# code or OData webservice but to find out:
- How to load the correct .NET CD DLL in PowerShell
- How to instantiate the right objects
like one would do in either Java or C#.