Solved

server list in AD

Posted on 2013-01-24
2
291 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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

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…
Experts-Exchange users below are the steps you can follow to upgrade your Lync server to latest CU's or cumulative updates. Note: Perform it during non-production hours.   Step 1: Backup your lync and SQL server database. Follow below article: h…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

772 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

11 Experts available now in Live!

Get 1:1 Help Now