However, the above script can get data for only 30 days. $SigninLogs | Export-Csv -Path $CSVPath -NoTypeInformation $LastLoginDate = Get-Date $SignInLog.LoginTime $LastLoginDate = "No Log-in Events Found!" $SignInLog = Get-UserLastLogin $_.ObjectID #Call the function to get the sign-in log Write-Progress -Activity "Checking Signin Logs:" -Status "Processing $($_.UserPrincipalName) ($Counter of $TotalUsers)" -PercentComplete (($Counter / $TotalUsers) * 100) #Recursive function call to retry the entry that was throttled Write-host "`tSleeping for 10 seconds due to throttling limitations." -ForegroundColor Cyan If ($message -like "*Too Many Requests*") $LoginDetails = New-Object psobject -Property = $SigninLog.CreatedDateTime $SigninLog = Get-AzureADAuditSignInLogs -All:$true -Filter "userID eq '$UserObjectID' and status/errorCode eq 0" | Select -First 1 #Get the Successful Signin Logs of the user Write-host -f Yellow "Collecting Last Login date of the User Object:"$UserObjectID #Function to get the last login time stamp of the userįunction Get-UserLastLogin( $UserObjectID)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |