Solved

server list in AD

Posted on 2013-01-24
2
292 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
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
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…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now