Solved

server list in AD

Posted on 2013-01-24
2
296 Views
Last Modified: 2013-02-11
Is there anyway we can find the list of servers in AD, is there any cmd command put that in a txt file?
0
Comment
Question by:pdsmicro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
BlueCompute earned 500 total points
ID: 38816954
Either use PowerShell, and run something like this one:
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.Filter = '(OperatingSystem=Window*Server*)'
"Name","canonicalname","distinguishedname" | Foreach-Object {$null = $objSearcher.PropertiesToLoad.Add($_) }
$objSearcher.FindAll() | Select-Object @{n='Name';e={$_.properties['name']}},@{n='ParentOU';e={$_.properties['distinguishedname'] -replace '^[^,]+,'}} | out-file C:\Servers.txt

Open in new window

Which will list all servers, and the OU they're in to C:\servers.txt if you genuinely want all boxes that are servers. If it's just Domain Controllers you need, this command line will do it:
Nltest /dclist:%yourdomain.local% >> C:\DCs.txt

Open in new window

You could try netdom like this:
netdom query SERVER
netdom query DC

Open in new window

But most or all of your workstations are probably listed as servers too, as they run the "server" service for admin shares etc.
0
 

Author Closing Comment

by:pdsmicro
ID: 38877044
thanks
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have put this article together as i needed to get all the information that might be available already into one general document that could be referenced once without searching the Internet for the different pieces. I have had a few issues where…
Microsoft has released remote PowerShell capabilities to all commercial Office 365 customers. So you can be controlled via PowerShell and not from the Office 365 admin center Download Windows PowerShell Module for Lync Online http://www.micros…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question