?
Solved

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

Posted on 2016-08-29
3
Medium Priority
?
23 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 1000 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 1000 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

Need protection from advanced malware attacks?

Look no further than WatchGuard's Total Security Suite, providing defense in depth against today's most headlining attacks like Petya 2.0 and WannaCry. Keep your organization out of the news with protection from known and unknown threats.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
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 …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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