Thursday, 19 August 2021

Find the last logon timestamp of users in Azure AD using PowerShell

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

Is Pondicherry, Celebrating Independence Day twice ?

 Is Pondicherry,  Celebrating   Independence Day twice ? Come on Lets Check! We all know India celebrates 15th August as Independence day Ev...