Forum Discussion
coxygt
Oct 12, 2022Brass Contributor
Last Login dates for all Guests using PowerShell
So I need to be able to report on all guest accounts on my companies tenant, to see the last time they logged on. AzureADSignin Logs are no good as they only cover last 30 days, I know somewhere wit...
- Oct 12, 2022Here's a sample script on that that I wrote a while back: https://www.michev.info/Blog/Post/2968/reporting-on-users-last-logged-in-date-in-office-365
To do it via PowerShell, use the Graph SDK:
Select-MgProfile beta
Get-MgUser -All:$true -Filter {userType eq 'Guest'} -Property UserPrincipalName,SignInActivity | select UserPrincipalName,@{n="LastLoginDate";e={$_.signInActivity.lastSignInDateTime}}
VasilMichev
Oct 12, 2022MVP
Here's a sample script on that that I wrote a while back: https://www.michev.info/Blog/Post/2968/reporting-on-users-last-logged-in-date-in-office-365
To do it via PowerShell, use the Graph SDK:
Select-MgProfile beta
Get-MgUser -All:$true -Filter {userType eq 'Guest'} -Property UserPrincipalName,SignInActivity | select UserPrincipalName,@{n="LastLoginDate";e={$_.signInActivity.lastSignInDateTime}}
To do it via PowerShell, use the Graph SDK:
Select-MgProfile beta
Get-MgUser -All:$true -Filter {userType eq 'Guest'} -Property UserPrincipalName,SignInActivity | select UserPrincipalName,@{n="LastLoginDate";e={$_.signInActivity.lastSignInDateTime}}