Forum Discussion
StevenRPF
Mar 02, 2023Brass Contributor
Export list users never loged in
I'm trying to use this script I've found on the internet : #Set admin UPN
$UPN = 'email address removed for privacy reasons'
#Time range
$startDate = (Get-Date).AddDays(-30).ToString('MM/dd/y...
Kidd_Ip
Mar 03, 2023MVP
Try this, to check user account under 'enable' condition, but never logged on or not logged in 60 days
Get-ADUser -Filter { Enabled -eq $True } -Properties LastLogonDate | #Tests whether LastLogonDate is older than 60 days or if it's $Null Where-Object { $_.LastLogonDate -lt (Get-Date).AddDays(-60) -or -not $_.LastLogonDate } | Select-Object -Property SamAccountName | Format-Table