August 27, 2010 at 1:28 pm
Hello
How can read from Active Directory every computer (host name)?
It would be best if this were possible with a select command, so that you could later access the host name with a View (view).
Of course, all servers use Windows 2008, are in a domain and it uses Microsoft SQL 2008th
I have already found the Internet a lot, but still not a simple example that I understood and was able to reproduce.
Thanks for your help.
Sorry for the bad English
August 27, 2010 at 1:42 pm
squicky (8/27/2010)
HelloHow can read from Active Directory every computer (host name)?
It would be best if this were possible with a select command, so that you could later access the host name with a View (view).
Of course, all servers use Windows 2008, are in a domain and it uses Microsoft SQL 2008th
I have already found the Internet a lot, but still not a simple example that I understood and was able to reproduce.
Thanks for your help.
Sorry for the bad English
To my knowledge (if I'm wrong, someone correct me), if you're asking how to read AD from SQL, the answer is: you can't.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
August 27, 2010 at 2:03 pm
I swear this worked at one point in time, but for some reason it doesn't now. I never used it directly, so it just ended up in code base and I have no reason to debug it, but it might give you a good starting point:
SELECT * FROM OPENROWSET('ADSDSOObject', 'adsdatasource;',
'SELECT
givenName,
sn,
userAccountControl,
mail,
physicalDeliveryOfficeName,
telephoneNumber,
cn,
mobile,
objectCategory
FROM ''LDAP://DC=DOMAIN, DC=local''
WHERE objectCategory = ''Person''')
This is for users, but you should be able to query whatever you want.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply