June 14, 2012 at 2:54 am
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:
Viewing post 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply