Forum Discussion
List all users' last login date
Staniko
Thank you for the above, looks exactly what I need but am getting the following error when running an elevated ISE PowerShell window:
Get-AzureAdAuditSigninLogs : The term 'Get-AzureAdAuditSigninLogs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:9 char:18
+ $LoginTime = Get-AzureAdAuditSigninLogs -top 1 -filter "userprinc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureAdAuditSigninLogs:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Any ideas? 🙂
Found on a Github post:
So solution was to restart Powershell and login to Azure AD using Connect-AzureAD from AzureADPreview module:
AzureADPreview\Connect-AzureAD
After that cmdlet became available.
- AnonymousAug 31, 2021
Get-AzureADAuditSignInLogs returns the events from the last month only, doesn't it?
- BasSterkenburgAug 31, 2021Copper Contributor
Deleted Well upon checking I noticed that even accounts which for sure where logged in the last month where noted without an last sign-in date in the output.
So after more searching I'm now using the solution found on : https://github.com/mzmaili/Get-AzureADUsersLastSignIn
It's also faster and gives me the correct data i'm looking for.