AzureAD users last login time stamp report

%3CLINGO-SUB%20id%3D%22lingo-sub-1604293%22%20slang%3D%22en-US%22%3EAzureAD%20users%20last%20login%20time%20stamp%20report%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1604293%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20someone%20please%20provide%20the%20PowerShell%20script%20to%20run%20the%20report%20of%20all%20the%20AAD%20licensed%20users%20along%20the%20last%20login%20time%20stamp%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1771749%22%20slang%3D%22en-US%22%3ERe%3A%20AzureAD%20users%20last%20login%20time%20stamp%20report%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1771749%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F421827%22%20target%3D%22_blank%22%3E%40Chirannjevi2330%3C%2FA%3E%26nbsp%3BYou%20can%20try%20something%20like%20below%2C%20or%20you%20can%20use%20the%20reports%20from%20your%20O365%20admin%20center.....%3CSPAN%3EO365%20admin%20center%20-%26gt%3B%20Reports%20-%26gt%3B%20Usage%20-%26gt%3B%20Active%20users.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24LiveCred%20%3D%20Get-Credential%0A%24Session%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-ConnectionUri%20https%3A%2F%2Fps.outlook.com%2Fpowershell%2F%20-Credential%20%24LiveCred%20-Authentication%20Basic%20-AllowRedirection%0ASet-ExecutionPolicy%20RemoteSigned%0AImport-PSSession%20%24Session%0A(Get-Mailbox)%20%7C%20Foreach%20%7BGet-MailboxStatistics%20%24_.Identity%20%7C%20Select%20DisplayName%2C%20LastLogonTime%7D%20%7C%20Export-CSV%20%24Home%5CDesktop%5CLastLogonDate.csv%0ARemove-PSSession%20%24Session%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3ELink%20to%20article%20below%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.spiceworks.com%2Fscripts%2Fshow%2F2290-last-log-in-time-and-date-powershell-script-for-office-365-to-desktop-csv-file%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELast%20log%20in%20time%20and%20date%20PowerShell%20script%20for%20Office%20365%20to%20desktop%20csv%20file%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Can someone please provide the PowerShell script to run the report of all the AAD licensed users along the last login time stamp?

1 Reply

@Chirannjevi2330 You can try something like below, or you can use the reports from your O365 admin center.....O365 admin center -> Reports -> Usage -> Active users.

 

$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Set-ExecutionPolicy RemoteSigned
Import-PSSession $Session
(Get-Mailbox) | Foreach {Get-MailboxStatistics $_.Identity | Select DisplayName, LastLogonTime} | Export-CSV $Home\Desktop\LastLogonDate.csv
Remove-PSSession $Session


Link to article below

Last log in time and date PowerShell script for Office 365 to desktop csv file