Solved

Powershell script to get report of AD user account's attributes

Posted on 2016-08-29
3
17 Views
Last Modified: 2016-10-15
I need a powershell script to retrieve attributes on AD accounts that are disabled, lastlogon, username, and description.   Prefer to have it done in Powershell or possibly a free tool and have it export into a CSV.
0
Comment
Question by:tools2teach
3 Comments
 
LVL 14

Accepted Solution

by:
Shabarinath Ramadasan earned 250 total points
ID: 41775257
From a machine where you have active directory modules installed

Get-ADUser -Filter {Enabled -eq "False"} -Properties lastlogondate, description |Export-Csv result.csv

Domain Controllers will have Powershell Ad modules installed. For member servers or clients, you need to install it first and import active directory module by running "Import-Module ActiveDirectory"

Here is some information on how to get Powershell AD Modules.
https://technet.microsoft.com/en-us/magazine/gg413289.aspx

Good luck !
1
 
LVL 12

Assisted Solution

by:Benjamin Voglar
Benjamin Voglar earned 250 total points
ID: 41775806
HI.

Shabarinath  gave the correct answer. I edited a Output a Little bit for you:

Get-ADUser -Filter {Enabled -eq "False"} -Properties lastlogondate, description | select SamAccountName,enabled,lastlogondate,description | export-csv -Path "C:\IT\disabledusers.csv"

Open in new window


Run the script on Domain Controler
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ACTIVE DIRECTORY 18 49
powershell question need assistance 10 32
Get-EventLog unable to read from Text File 2 24
User account lockout - Server 2012R2 7 30
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question