Solved

Powershell script

Posted on 2016-11-18
3
64 Views
Last Modified: 2016-11-22
I need a PowerShell script that list all users that have not log in to the Domain for the past 30/90 days and I need to print this list, I'm new to PowerShell can someone help? I will really appreciate any help
0
Comment
Question by:FCHCAdmin
3 Comments
 
LVL 5

Assisted Solution

by:Austin Texas
Austin Texas earned 250 total points
ID: 41893734
This expert suggested creating a Gigs project.
You could use this command:
Search-ADAccount -AccountInactive -TimeSpan 30 -UsersOnly | Where-Object { $_.Enabled -eq $true } | Format-Table Name, UserPrincipalName

Open in new window

Here is a sample script that you could start with: https://gallery.technet.microsoft.com/scriptcenter/Export-Last-Logon-Times-4fcb07cb
0
 
LVL 3

Accepted Solution

by:
Ed Dredd earned 250 total points
ID: 41894540
Get-ADUser -filter * -properties LastLogonDate`
| sort-object name | select-object Name, LastLogonDate `
| Export-csv -path c:\user-LastLogonDate.csv
0
 

Author Comment

by:FCHCAdmin
ID: 41897914
Thank you all.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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