In Need of an Active Directory Powershell Script

I need help on creating a Powershell script that will generate a list of users that include First Name, Last Name, User ID, Create Date and Last Logon columns.

Thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Joseph MoodyBlogger and wearer of all hats.Commented:
get-qaduser * -sizelimit 0| select firstname,lastname,SAMAccountName,CreationDate,LastLogon
Joseph MoodyBlogger and wearer of all hats.Commented:
That uses the Quest AD modules
Joseph DalyCommented:
Using the MS powershell AD cmdlets you would do something like the following.

Get-aduser -filter * -properties * | select-object surname, givenname, samaccountname, whencreated, lastlogontimestamp

I do prefer the quest cmdlets a little bit because they will automatically convert the time to a human readable time.
Will SzymkowskiSenior Solution ArchitectCommented:
It is best to only filter on the properties that are required so that the query does not use as much resources. It would look like below...

The script below will export all users with the properties you have requested and export the results to a CSV file.

Import-module activedirectory
Get-ADUser -Filter * -Properties name, surname, samaccountname, whenCreated, LastLogonDate | 
select name, surname, samaccountname, whenCreated, LastLogonDate | 
Export-Csv "c:\ADUserList.csv" -nti

Open in new window


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
BuRinger7aAuthor Commented:

I tried your solution first and it worked great.....Thanks!
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

From novice to tech pro — start learning today.