custom search ad users and computers.

is there anyway in ad users and computers to run a report to list all users (logonname), their status (i.e. disabled/expired/active) and the fields lastlogon and lastlogontimestamp. I thought there may be a way to do it in custom search area of a new query in ADUC, but couldnt find the fields. If I double click a user objecy in ADUC the fields and dates can be found in the attribute editor tab.
 
Any help most welcome. Can it be done in the LDAP query section?
LVL 3
pma111Asked:
Who is Participating?
 
Justin YeungSenior Systems EngineerCommented:
This one line powershell command can export the data that you want to get from AD

Import-Module ActiveDirectory
Get-Aduser -Filter * -Properties * | Select-Object Name,SamAccountName,Enabled,AccountExpirationDate,@{Name="LastLogonTimestamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}},@{Name="Lastlgon"; Expression={[DateTime]::FromFileTime($_.lastlogon)}},LastlogonDate | Export-Csv C:\Export.csv

Open in new window

0
 
CamyCommented:
Powershell would probably be the way to do it - what version of Windows Server are you running?
0
 
pma111Author Commented:
Do you have to download something first before this will work, i.e. the AD module?
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
pma111Author Commented:
2008 - but I wanted to know (as per the question) if it was do-able within ADUC.
0
 
Justin YeungSenior Systems EngineerCommented:
probably not in ADUC
0
 
CamyCommented:
Definitley not in ADUC, the columns available for results are limited.
If you are running it from the Domain Controller it should have the AD module (and powershell) available already.
0
 
pma111Author Commented:
will give the powershell solution a go. many thanks
0
 
Justin YeungSenior Systems EngineerCommented:
RSAT on workstation or run it directly on a Domain controller which already include Active Directory powershell Module.
0
 
chuckmcculloughCommented:
You can add to the columns available for display in ADUC using ADSIEdit. Here are a few sites with examples:

http://markparris.co.uk/2011/12/12/add-operating-system-and-service-pack-information-to-active-directory-users-and-computers/

http://pberblog.com/post/2009/06/21/Add-extra-columns-to-Active-Directory-Users-and-Computers-display.aspx

I ran a quick test just now and unfortunately ADUC doesn't produce much for the fields you need for this particular report. The examples provided on the links above might prove useful for future reports, though.

If you aren't comfortable diving into PowerShell as mentioned above, most of the popular GUI utilities out there should give you this report fairly easily. The company I work for has a product called Hyena that allows you to create reports like this by picking and choosing the attributes you want:

http://www.systemtools.com/hyena/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.