query to find SQL Servers from active directory

  • Is there anyway,can we find the list of servers by querying at active directory?

    Thanks.

  • SQL-DBA-01 (3/3/2015)


    Is there anyway,can we find the list of servers by querying at active directory?

    I don't think that's a good idea.

    The active directory is basically a another database, a repository of AD objects. Unless you or your Domain Admin created an specific OU and put all SQL server boxes there, I don't think how useful a query against it would be. Unless ... your servers have some type of naming convention. But still, not sure how accurate the information will be. I've seen cases of old or dropped servers which computer object is still in AD. It should not, if removed properly, but I have seen those cases before.

    Having said that, I think you may probably able to do that via PowerShell? with proper permissions, of course.

  • A little bit of Google magic my friend:

    Searching Active Directory with Windows PowerShell

    I am sure there is much more out there.

  • i just used this powershell script, that i found after investigating your request

    http://blogs.metcorpconsulting.com/tech/?p=343

    i had to find and replace wierd left and right double quotes with normal double quotes to make it work, as well as a trailing comma in the first thre elines of the script.

    also on my local windows 7 machine, import-module ActiveDirectory failed,as it was not installed.

    i had to install the prerequisites from microsoft, then go to add/remobe programs and add features to windows, like this blog says:

    http://blogs.msdn.com/b/rkramesh/archive/2012/01/17/how-to-add-active-directory-module-in-powershell-in-windows-7.aspx

    i found 56 sql servers isntance svia this method, and some of them i was not aware of at all.

    checking to see if they belong under ,my umbrella or not.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 4 posts - 1 through 3 (of 3 total)

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