LDAP PrinterQueue query

  • Hi,

    I am trying to pull information about listed printers from our AD.

    So far I can get basic information about the printers, but am missing stuff like:

    Permissions (ACL)

    PortName / Port

    Description / Comment

    sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'

    GO

    SELECT REPLACE(AD.ServerName, '.etc.domain.eg','') ServerName, AD.PrinterName, AD.Location, AD.DriverName, UNCName

    FROM OPENQUERY(ADSI,'SELECT UNCName, ServerName, PrinterName, Location, drivername FROM ''LDAP://DC=etc,DC=domain,DC=eg'' WHERE objectClass= ''PrintQueue'' ORDER BY Name') AD

    When adding description or portname to the select list I get the following error:

    Cannot get the data of the row from the OLE DB provider "ADSDSOObject" for linked server "ADSI". Could not convert the data value due to reasons other than sign mismatch or overflow.

    This is apparently due to multivalued results. I found the b.m. article, but still don't know if it is possible to get the desired results even using multiple queries and performing joins. I also don't see why a description or portname is multivalued.

    Has anyone got an idea on how to get the extra information?

    Thanks

    SQL LDAP query explaination:

    http://support.microsoft.com/kb/299410

    PrintQueue object attributes:

    http://technet.microsoft.com/en-us/library/ee176750



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

Viewing post 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply