Forum Discussion
DeanKing182
Nov 10, 2023Copper Contributor
I need to export Guest users' "Last Login Date/Time".
Could anyone point me in the right direction to export a CSV of last login date/time for Guest users on Entra/Azure AD?
I can see the data in Entra by adding the 'Last Login Time' column but when exported, this column isn't included.
3 Replies
- You can do something like this:
Get-MgUser -Filter "userType eq 'Guest'" -All -Property Id,userPrincipalName,signInActivity | select Id,UserPrincipalName,@{n="LastLogin";e={$_.SignInActivity.lastSignInDateTime}}
This leverages the Graph SDK for PowerShell. If you need additional properties, make sure to add them both under the -Property list and under the select statement.- DeanKing182Copper ContributorThanks for this. How do I carry out the above?
- Via Graph SDK for PowerShell: https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation?view=graph-powershell-1.0