Solved

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

Posted on 2011-02-22
4
510 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
4 Comments
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 250 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 250 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This article explains how to install and use the NTBackup utility that comes with Windows Server.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

679 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