Solved

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

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

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
OfficeMate Freezes on login or does not load after login credentials are input.
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…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

760 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

21 Experts available now in Live!

Get 1:1 Help Now