Link to home
Start Free TrialLog in
Avatar of Carl Webster
Carl WebsterFlag for United States of America

asked on

List all servers in Active Directory

Need a script to list all servers in Active Directory.  From Windows 2000 Server all the way up to and including Windows Server 2008 R2.  Need to make sure all Editions are included.  e.g. Advanced, Standard, Enterprise, Datacenter and 32-bit and 64-bit versions.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of KenMcF
KenMcF
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Carl Webster

ASKER

My problem is I do not know if PS is installed on any server or if I will be allowed to install PS.

I just emailed the customer to find out.  It would be nice if PS is installed or they give me permission to install it.

All I need is the "cn" attribute (according to the test dsquery I ran) which should be the server's hostname.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That should be

get-qadcomputer -sizelimit 0 | where{$_.operatingsystem -match "Server"} | select name
"My problem is I do not know if PS is installed on any server or if I will be allowed to install PS."
Check if you have a Windows 2008 R2 Domain Controller. If you do, you have the MS AD Powershell Console already.
KenMcF, where do I get and how to I install the Quest AD cmdlets?

I have two other questions I posted this morning.  This file of server names will be used by another script to list all local groups on each server and the members of each group including nested groups.
acbrown2010, when I test this on my lab 2008 R2 DC, I get an error saying the term get-adcomputer is not recognized yada yada yada.
acbrown2010, sorry didn't realize I had to do this:

When the Active Directory module is installed, to start it click Start, point to Administrative Tools, and then click Active Directory PowerShell
I wound up just using ADFind to do this since the AD and all DCs were 2000.