Active Directory

Powershell Script to Get “lastLogon Timestamp” for Specific OU and Export to CSV File

Posted on

  Learn how to get lastlogon timestamp for specific OU and export to CSV by using Powershell script. A PowerShell solution using the AD module cmdlet: Get-ADUser -Filter * -SearchBase “ou=users,dc=contoso,dc=local” -ResultPageSize 0 -Prop CN,lastLogonTimestamp | Select CN,lastLogonTimestamp | Export-CSV -NoType last.csv   If you want get a date: Get-ADUser -Filter * -SearchBase “ou=users,dc=contoso,dc=local” -ResultPageSize […]