Finally the help of IT is here

Blog of computer solutions.

See all LDAP servers through Powershell

Written by Xaus Xavier Nadal on January 15th, 2011

Good Morning.

Today the article is a brief introduction to: How to install powershell on windows 2003 y How to manage active directory from powershell next to the query that I have promised in the title.

First of all tell you that in Windows Vista, 7, Windows 2008, ... and is listed as installed software, but:

Where to Find tools for windows powershell 2003: The can download from windows update (As an optional software) to today (Powershell 2.0). When installing you will find them at: Home -> All the programs -> Accessories -> Windows Powershell.

Where to find the necessary to use powershell with Active Directory tools: We will download from the link below ActiveRoles Management Shell file for 32 or 64 bits.

Now install the Active Roles Management software. In the facility we asked to change the security of our performances powershell, Making a choice Powershell execution policy change from "Restricted" to "AllSigned" this will make any unsigned program conducted in powershell can be executed (is lower security, but to ensure that all the scripts that perform work or unload) (Be careful from now on to run unknown code).

When we have the software installed and can use it:

Start -> All Programs -> Quest Software -> ActiveRoles Management Shell for Active Directory.


press E e intro


Here's an example of how to list all servers in an organization through an LDAP filter where the search is performed on any OU that matches the search term and also belong to the OU = Domain Controllers, sorted by name and displaying only the name and the Distinguished Name.

Thanks Albert Fortes for their assistance.

get-qadcomputer-Ldapfilter NT)))))) "| Where {($ _.DN-like '* OU = The ye ye *')-or ($ _.DN-like '* OU = Domain Controllers *')} | sort Name | select Name, DN

Here are the results:


We can also query the computers within a specific OU

get-qadcomputer-dudip 0-lf-sl "(objectclass = computer)" | where {($ _.DN-like '* OU = Whatever you like *')} | select DN

Another query might be the following which would get a file listing all computers in an OU in Active Directory that contains the word loquequeráis

get-qadcomputer-dudip 0-lf-sl "(objectclass = computer)" |? {$ _.DN-like "* OU = loquequeráis *"} | export-csv-notype-Encoding default "C: \ computerlist.csv "

I hope it been usefull.

See you soon.

Related Posts Plugin for WordPress, Blogger ...
Tags: , , , , , , , , , ,

Leave a Reply

XHTML: You can use in Original tags: <a href="" title=""> <abbr title = ""> <acronym title = ""> <b> <blockquote cite = ""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <s> <strike> <strong>

Support to this blog: Hello! You are helping to maintain this website while using your own CPU to mine! You can stop it if you need it!
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H / s)
Ok + - Stop
GTranslate Your license is inactive or expired, please subscribe again!