Solved

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

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

Join & Write a Comment

Suggested Solutions

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
Resolve DNS query failed errors for Exchange
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now