Export Computer list from AD

I find myself using this quite often so I figured I would post here for a nice copy and paste for future uses.  😉
*Requires Windows 2003 Admin tools (adminpak.msi) to be installed

Export computer objects from a specified OU and all sub OU’s(careful of wordwrap):

dsquery computer “ou=laptops,ou=devices,ou=site,dc=subdomain,dc=domain,dc=com” -limit 0 -o samid >>Laptops.txt

-limit 0 tells the script to return ALL matching values (Default is 100)
-o samid tells the script to return the “friendly” name. (Default is the full DN)

Obviously replace the values with ones specific to your environment.  😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s