Solved

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

Posted on 2016-08-29
3
20 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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

837 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