Solved

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

Posted on 2011-02-22
4
508 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
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…

813 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

12 Experts available now in Live!

Get 1:1 Help Now