Solved

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

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

Percona Monitoring and Management and Grafana

Proactive monitoring is vital to a highly-available environment. We have a quick start guide on Experts Exchange for Grafana users.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

623 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