Find the last logon timestamp of users in Azure AD using PowerShell
get-ADUser - filter {enabled -eq $true} -properties LastLogonTimeStamp | Select-object Name,@{Name="Stamp"; Expression={[DateTime] ::FrmFileTime($_.LastLogontimeStamp).Tostring('yyy-mm-dd_hh:mm:ss')}} | Export-csv -Path C:\Users\Ravanan\lastlogon.csv
PS: check in Dev before running on Prod
No comments:
Post a Comment