October 14, 2002 at 5:05 am
I have a table created by the IIS log feature that contains a column with user network ID (i.e. domain/username). I want to resolve that login short name to the users full name.
Unfortunately the domain that this runs on is WinNT4 and does not have Active Directory. Therefore I cannot use the LDAP method:
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject', 'adsdatasource'
SELECT cn FROM
OPENQUERY(ADSI,'''SELECT cn
FROM ''LDAP://<Servername>/ CN=Users,DC=andrew,DC=com''')
I've tried substituting the LDAP connection method for:
SELECT * FROM
OPENQUERY(ADSI,'''SELECT * FROM ''WINNT://<domain>/<username>,user''')
But that doesn't work at all. I refuse to believe that it is not possible to retrieve WINNT account information from within either a trigger, view or stored procedure within SQL Server.
Set up is as follows:
Windows 2000 domain member server running IIS 5.0 and SQL Server 2000 contacting a Windows NT 4.0 domain.
Can anybody help?
Thanks
Andrew Minor
October 14, 2002 at 10:02 am
I can't recreate the problem as I don't have any NT machines to connect to, but I recently spotted these two short articles which might be relevant (?)
http://www.microsoft.com/windows2000/server/evaluation/news/bulletins/adextension.asp
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q275917&
Failing that, can you connect to the WinNT thingummy in an ASP page? e.g.
Set PrimDomainContr = getobject("WinNT://YourDomain")
Response.Write "WinNT Domain Name:" & PrimDomainContr.name & "<p/>"
If this works, you could resolve your long user name in an ASP page.
October 14, 2002 at 1:05 pm
Don't know anything that exists in SQL right off but take a look here at a C++ example on how to do this. It can be converted into an XP process which could be called from inside SQL server. If you need I can build a XP dll but it will be a week or two before I have time on my developement machine.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
October 15, 2002 at 3:19 am
Thanks all for your replies and offers of help. I currently have an ASP page running that correctly retrieves the user name from the WinNT domain however it is slow. I was hoping that by implementing it as a stored procedure or trigger I could schedule it to run once every day and improve speed at the same time.
Although not my preferred choice I will go down the DLL/EXE route and have that code modify the relevant tables.
Thanks
Andrew
October 15, 2002 at 12:44 pm
I do something similar to what you are trying to do. I've got a Perl script which goes out and retrieves a list of the domain users. It then retrieves most of the "miscellaneous" attributes for those users, including the full name, and inserts the information back into a SQL table using ADO (I didn't use DBI for supportability within my org). I've got a SQL Server Agent job that runs once a night and retrieves the info. It's not very hard at all, especially with the Win32::AdminMisc package available from http://www.roth.net/perl/
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply