How to get the list for SMTP address and Last connection time for all the users
Summary
This article describes how to use PowerShell Commandlet to get the list for SMTP address and Last connection time for all the users.
Steps to implement the request
Step 1: Run the following to authenticate yourself and import PowerShell commands to your local session:
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Step 2: Run the Commandlet to get the SMTP address and Last connection time for all the users.
Commandlet to get SMTP address:
Get-Mailbox | fl EmailAddresses, identity > C:\Emailaddress.csv
Commandlet to get Last connection time:
Get-Mailbox -ResultSize unlimited | Get-MailboxStatistics | select-object identity,lastlogontime,lastlogofftime,DisplayName | sort-object DisplayName -descending | export-csv D:\Lastlogontime.csv
Step 3: Run the following to remove the authentication
# Removes the Session as only 3 sessions are allowed
Remove-PSSession $Session
$importresults = ""
$Session = ""
More Information
Add your domain to Office 365 without redirecting your name server records to Office 365
https://onlinehelp.microsoft.com/en-us/office365-smallbusinesses/hh416759.aspx
Move your email to Office 365 and keep your current public-facing website
https://onlinehelp.microsoft.com/en-us/office365-smallbusinesses/hh335299.aspx
Update DNS records to keep your website with your current hosting provider
https://onlinehelp.microsoft.com/en-us/office365-smallbusinesses/hh335298.aspx
Assigning administrator roles
https://onlinehelp.microsoft.com/en-us/office365-enterprises/ff637584.aspx
Use Windows PowerShell to manage Office 365
https://onlinehelp.microsoft.com/en-us/office365-enterprises/hh124998.aspx
Please check this link for Windows PowerShell cmdlets for Office 365
https://onlinehelp.microsoft.com/en-us/office365-enterprises/hh125002.aspx
Applies To/Requirements
Office 365