Powershell Script to Filter AD Accounts and List Attributes

I'm looking for a Powershell script that will list all active users in AD, and also list certain attributes such as name, username, title, and account creation date. This is my first attempt at Powershell, and I've found two scripts that are close to what I'm looking for, but I need a way to combine them.

get-aduser -filter {enabled -eq $true} -Properties whenCreated, title

This script seems to output all of the info I need in a list.

get-aduser -filter {enabled -eq $true} | select name, samaccountname, creationdate, title

This script outputs to a nice table, but the creationdate column is blank.

Does anyone know how write this script so that it's formatted like the table in the second example, but contains all the info I need?

By the way, I'm running Windows Server 2008 R2.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

x-menIT super heroCommented:
get-aduser -filter {enabled -eq $true} | ft -Properties name, samaccountname, creationdate, title -autosize

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brad212Author Commented:
Thanks x-men. That looks promising, but when I run it I get:
Format-Table : A parameter cannot be found that matches parameter name 'Properties'.

Any ideas?
x-menIT super heroCommented:

sorry, was thinking in english, not in PS...
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Brad212Author Commented:
That helped. I was able to run the script successfully, but my creationdate column is still blank. When I run script #1 from my post, I get real dates returned for whencreated. But when I run your script, I get blanks for creationdate. I tried substituting whencreated for creationdate in your script, but the column is still blank.

I tried an experiment. I took out creationdate and put in 'duck' without quotes. The script generated a table with a column called duck which was all blanks. I'm pretty sure there isn't an AD attribute called duck, so it appears that the script will generate a column for any word, whether its an attribute or not.

Is there another term I should be using instead of creationdate?
x-menIT super heroCommented:
get-aduser | get-member

for a list of attributes
Brad212Author Commented:
It seems like the attribute is WhenCreated, but neither that nor CreationDate returns any results in my table. Its strange that it works in my first script but not the second. I decided to use an AD tool called AD Info Free to run a query and export the results to CSV file. Thanks for your help, X-men.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.