RSS

PowerShell – Use Get-ADcomputer to get a quick overview of your AD environment

24 Feb

One of the tasks in ICT is maintaining an up-to-date and correct CMDB. This is also a hard task and is often not performed (properly).

Luckily however, with the PowerShell Get-ADcomputer you can get a lot of information directly from Active Directory. Try using: Get-ADComputer -Filter * -Properties *

Ofcourse if you have non-domain joined computers or non-Windows based computers you have to come up with something for that as well.

Personally, I use this command to quickly get info about my Home Lab instead of having to document it manually (with the risk of human error):
Get-ADComputer -Filter * -Properties * | select name,canonicalname,dnshostname,operatingsystem,OperatingSystemServicePack,operatingsystemversion,IPv4address | out-gridview

In the image below you can see what it looks like for me:

Get-ADcomputer

You can of course customize it and alter the output method. You could by example add the property Modified to see when it was last changed. You can also add the property Description if this makes sense for you. I did not enter descriptions myself, but for the cluster nodes it has been added automatically and says: “Failover cluster virtual network name account”.

About these ads
 
4 Comments

Posted by on February 24, 2013 in ICT, Microsoft, Powershell

 

Tags: , , , ,

4 responses to “PowerShell – Use Get-ADcomputer to get a quick overview of your AD environment

  1. Arun

    March 19, 2014 at 20:01

    it works

    can you help me to get the script for all the computers that start with “DB”..in gridview i am able to filter..i need the query

    Like

     
    • Bjorn Houben

      March 26, 2014 at 12:42

      Do a “Get-Help Get-AdComputer -examples” and you should be able to find what you want:
      Get-ADComputer -LDAPFilter “(name=DB*)”

      Like

       
  2. susguperf

    June 20, 2014 at 18:21

    Hey Bjorn..!!!!
    You have set a very good example however I would need to see using which command I could get the list of all the attributes of every object in AD for example for user, I need to know the name, email, address, account expire — it should be listed in the console of the powershell..

    For Example to list all the Win32 classes of WMIObject
    get-wmiobject -list win32*

    So, here I would need all the filter examples if I am using Get-ADComputer, I should see in the list and it can used in my script. I hope I have not confused you.

    Thanks again for the reply Man..!!!!
    Appreciated…
    Susguperf

    Like

     

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

 
Follow

Get every new post delivered to your Inbox.

Join 866 other followers

%d bloggers like this: