?
Solved

Is there one cmd-let in powershell that lists servers/Pcs

Posted on 2011-02-22
4
Medium Priority
?
513 Views
Last Modified: 2012-05-11
Is there one cmd-let in powershell that lists servers/Computers in the computer OU within AD.  I just thought you could run a cmd rather then a whole script.  Let me know and thanks in advance.
0
Comment
Question by:vitengineering
[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
4 Comments
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 1000 total points
ID: 34958418
Have you tried with Quest AD cmd-lets? Download them from
http://www.quest.com/powershell/activeroles-server.aspx

and run this query

 
Get-QADComputer -SearchRoot "cn=Computers,dc=YourDomain,dc=local" | Select Name,OSName,OSServicePack,ComputerRole | Export-Csv c:\filename.csv

Open in new window


Regards,
Krzysztof
0
 
LVL 17

Assisted Solution

by:Learnctx
Learnctx earned 1000 total points
ID: 34966670
There are some MS cmdlets as well which are available. The Quest tools are a lot simpler (best PowerShell tools ever :)), but some people prefer using MS cmdlets over third party vendors. But this could be a bit of effort depending on how your environment is setup.

Get-ADComputer CmdLet: http://technet.microsoft.com/en-us/library/ee617192.aspx
Info: http://technet.microsoft.com/en-us/magazine/ee914610.aspx
0
 
LVL 10

Expert Comment

by:wls3
ID: 35028155
You can connect directly to a DC using the WinNT provider and search the object that way:

http://learningpcs.blogspot.com/2011/01/powershell-winnt-provider.html

For a more explicit route, you can look at the DirectoryServices namespace:

http://www.powershellpro.com/computernames-activedirectory/149/

Or, you could refashion some VBScript to use a COM interface:

http://www.petri.co.il/forums/showthread.php?t=21919

Alternatively, you could just pass a command down to the dsquery .exe and store the results in a variable.
0
 

Expert Comment

by:mrc032
ID: 35208335
Thanks used it!
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

719 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