Hi @C Pradeep,
Thank you for posting in this community.
Please try to use the Merge-SPUsageLog cmdlet. Here is an example PowerShell script that retrieves the last 10 login user IDs and timestamps:
Merge-SPUsageLog -StartTime (Get-Date).AddDays(-1) -EndTime (Get-Date) | ? { $_.EventId -eq "14" } | Select-Object -First 10 | Select-Object UserDisplayName, Timestamp | Sort-Object Timestamp -Descending
This script retrieves the usage logs from the last day, filters for login events (EventId 14), selects the first 10 results, and sorts them by timestamp in descending order. The output will include the user display name and timestamp for each login event.
References:
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.