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:
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”.
March 19, 2014 at 20:01
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
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*)”
June 20, 2014 at 18:21
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..!!!!
June 21, 2014 at 08:57
Normally you would just use Get-Member: Get-Process | Get-Member
For more info see: http://technet.microsoft.com/en-us/library/ee176854.aspx
With AD cmdlets like Get-ADcomputer and Get-ADuser it’s a bit different. You would use by example: Get-AdComputer -Identity -properties * | Get-Member