Solved

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

Posted on 2016-08-29
3
21 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
The viewer will learn how to count occurrences of each item in an array.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

726 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