Written by James McDonald

November 14, 2023

Get-ADUser -Filter {Enabled -eq $true} -Properties Name,Manager,LastLogon,DistinguishedName | 
Select-Object Name,samAccountName,DistinguishedName,@{n='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon).ToString('g')}} | 
Export-Csv -NoTypeInformation -Path LastLogonEnabledOnly.csv

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…