Forum Discussion
Chad Rodriguez
May 15, 2020Copper Contributor
Inactive Guest users in Azure Active Directory Organizational relationships
Need a Power Shell script that would provide a list of stale guest accounts with the last log in date for users who don't have a mailbox? Additionally that haven't signed in for 90 days. These are...
- May 15, 2020
I have a sample script here: https://github.com/michevnew/PowerShell/blob/master/Graph_Last_Login_Date.ps1
https://github.com/michevnew/PowerShell/blob/master/Graph_Last_Login_Date.md
But it still requires you to fiddle with it a bit if you only want the Guest users data, and setting it up might also be challenging if you haven't done such things before. Your only other option is to get the Sign-in logs from the Azure AD blade, then filter them out in a external tool.
VasilMichev
May 15, 2020MVP
Use the SignInActivity property/endpoint: https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-beta&tabs=http#example-3--list-users-including-their-last-sign-in-time
- Chad RodriguezMay 15, 2020Copper Contributor
Thanks, but how would one use this please? Not familiar with coding. Was looking for a powershell script please.
- VasilMichevMay 15, 2020MVP
I have a sample script here: https://github.com/michevnew/PowerShell/blob/master/Graph_Last_Login_Date.ps1
https://github.com/michevnew/PowerShell/blob/master/Graph_Last_Login_Date.md
But it still requires you to fiddle with it a bit if you only want the Guest users data, and setting it up might also be challenging if you haven't done such things before. Your only other option is to get the Sign-in logs from the Azure AD blade, then filter them out in a external tool.
- PeterJ_InobitsMay 15, 2020Iron Contributor
Is that basically the same approach you would give PowerBI rights to do the same type of User queries?
As I read things there is no Powershell cmdlet, at least in the MS supplied module, for this type of query.
- PeterJ_InobitsMay 15, 2020Iron Contributor
Chad Rodriguez With a bit of back end work you can actually put that code chunk into a Powershell script if I recall correctly...