powershell script to list all servers in the forest

Windows PowerShell

Image via Wikipedia

I was looking for a way to get a list of all server in our AD forest.

Here’s what I have so far

Get-QADComputer -searchroot 'DC=domain,DC=com' -OSName 'Windows*Server*'| format-Table name, OSName –auto

Even though domain.com is the root of our AD forest its not searching the entire subtree.

I’ve used many different sites to put this script together so far and I wanted to give them credit.

http://www.computerperformance.co.uk/powershell/powershell_qad_computer.htm – This is a great site with basic powershell info.

http://synjunkie.blogspot.com/2009/04/powershell-vs-conficker.html – good example on using filters and pipes

http://www.networkworld.com/community/node/42303 – examples of how to use the searchbase option.

I’m still searching for how to search all domains in the forest and I’ll update this post when I figure it out.

Reblog this post [with Zemanta]

About the Author

Jason Benway Has Written 1361 Articles For Us!

I am the admin of this site and enjoy enterprise technologies and gadgets.
Getting The Latest Tweet...
Did you know Jason has a website? Go see what you're missing...

Related posts:

  1. powershell to get network settings
  2. The Shonk Project – Delete Profiles Script
  3. Referall Script
  4. Windows Admin Script: Defrag Drives Based on Threshold
  5. PowerShell: Microsoft releases a new Windows Command Prompt

Related posts brought to you by Yet Another Related Posts Plugin.