Printing results from an Active Directory Administrative Center query

Recently a question was asked on the blog regarding printing queries from Active Directory Administrative Center (ADAC).  There is no native functionality for printing queries performed in ADAC, but there is a workaround.

1.  Open ADAC and create a query:

Global Search query


2.  Convert the query to LDAP:

Convert query to LDAP


3.  Open the Active Directory module for Windows PowerShell and copy the filter into the Windows PowerShell command window:

Windows PowerShell cmd

You can now print the corresponding text file that contains the results of your query.

Comments (3)

  1. BeesZA says:

    PS C:> import-module activedirectory
    PS C:> Get-ADObject -LDAPFilter (&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:
    =2)(|(lastLogonTimestamp<=130291128000000000)(!lastLogonTimestamp=*))) Missing expression after unary operator '!'. At line:1 char:71 + Get-ADObject -LDAPFilter (&(objectCategory=person)(objectClass=user)(! <<<< userAccountControl:1.2.840.113556.1.4.803 :=2)(|(lastLogonTimestamp<=130291128000000000)(!lastLogonTimestamp=*))) + CategoryInfo : ParserError: (!:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingExpressionAfterOperator

  2. BeesZA says:

    This is what I get when I try it, see above

  3. LA Richards says:

    I think that's a cool method for getting a better understanding of LDAP query syntax.  The only thing I would add is the use of the 'out-printer' cmdlet if you wanted to just send the output directly to the printer without creating a new text file.

Skip to main content