Domino : How to query a domino server in powershell

No doubt there are many ways to extract data from an IBM domino server but if you’re like me you will want a way to do this in PowerShell because we like to do everything in Powershell.

Create the connector

First we need to create a variable that will hold the directory services system.
Where my settings = :-
Domino2 = This is your domino server name.
YourDomain = This is your company domain name e.g.
Reelfunky = Your domino admin user name.
Reelfunky123 = Your admin password.

$root = New-Object -TypeName System.DirectoryServices.DirectoryEntry("LDAP://Domino2/o=YourDomain", "Reelfunky", "Reelfunky123",`

Create a directory searcher

Now we need to make a directory Searcher variable which we can use to search the directory we placed in $root

$query = New-Object System.DirectoryServices.DirectorySearcher($root)

Create the query

We can now create queries using the .filter switch . In this example I am asking for all common name entries at the root level by using the wildcard *

$query.Filter = "(cn=*)"

Get the results

Now we use the FindAll() switch to show us all the results.

$result = $query.FindAll()

Some other query examples

Here are some more query examples which can be used to refine your search

$query.Filter = "(cn=*)"
$query.Filter = "(objectClass=*)"
$query.Filter = "(objectClass=dominoPerson)"
$query.Filter = "((objectclass=dominoPerson)(cn=texas))"
$query.Filter = "(cn=london)"
$query.Filter = "(objectClass=mail)"

The full script

$root = New-Object -TypeName System.DirectoryServices.DirectoryEntry("LDAP://reelfunky", "ricky", "mypassword", [System.DirectoryServices.AuthenticationTypes]::None)
$query = New-Object System.DirectoryServices.DirectorySearcher($root)
$query.Filter = "(cn=*)"
$result = $query.FindAll()
echo $result

Cut & Paste

// Collect comments ''