Hello readers. As always I hope this finds you well. This odd little post is just a brain dump of information I found when researching how to get some information out of Lync Online and Exchange online for a customer I am working with. This customer was specifically interested in finding out if users were using Lync Online.
Those of you that are familiar with Office 365 know that there are a bunch of reports built into the Office 365 Admin Center. Tim Woo does a great job describing what you get Here. And below is a quick screen grab from the post.
While the information you get from the Admin Center is very good at telling you how many of your users are using it, for what and how often, it is lacking one important piece of information. And that is which of your users are using it. This is particularly important when you produce a report in the Admin Center that states that 400 users are logging in and showing as active, but you have 1,200 users enabled. You need to know which users are using it. Then you can concentrate on the other 800. After all, a project to implement a UC platform such as Lync is only deemed as a success if the users adopt and use it. So you definitely need to know this.
If you have Lync installed on-premises the information is a little easier to get. After all it is your Active Directory and if you have the Monitoring Role installed and working, your SQL server. So running reports on it is pretty straightforward.
If, however, you are running in Office 365 you only get the information Microsoft serve up to you. As I mentioned above, this is just numbers. You might need to know who and when for that matter.
The information you can get from the command which is the ultimate focus of this post is a list of users and the last date they logged in. This tells you that they logged in and used any application which is available in your tenancy. If you are interested in Lync specifically and the users also use Exchange and SharePoint etc, then this isn’t for you. Conversely, if all you use is Exchange and all you are interested in is Exchange then this is still pertinent.
Luckily, however, the customer I am working with is ONLY interested in, and using Lync Online. So the information they will get is exactly what they are after to show who is using it and when they did.
First, you need PowerShell 3.0 or better. To determine which version you have run PowerShell as Administrator and enter get-host. As you can see below I have version 4 which is the standard version on Windows 8.1. If you are on a lower version then 3 you need to download and install it. – Windows PowerShell 3.0
import-module LyncOnlineConnector
$cred = Get-Credential
$LyncSession = New-CSOnlineSession -Credential $cred
Import-PSSession $LyncSession -AllowClobber
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://outlook.office365.com/powershell-liveid/” -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $ExchangeSession -AllowClobber
- Get-CsActiveUserReport : shows statistics about the number of active Lync Online users over time.
- Get-CsConferenceReport : shows statistics about the conferences held in Lync Online.
- Get-CsAVConferenceTimeReport : shows statistics about the duration (minutes) used by audio and video conferences.
- Get-CsP2PSessionReport : shows statistics about peer-to-peer sessions that took place in Lync Online.
- Get-CsP2PAVTimeReport : shows statistics about the duration of audio and video in peer-to-peer Lync Online sessions.
Get-User -resultsize unlimited | Get-MailboxStatistics | select DisplayName, LastLogonTime
Get-User -resultsize unlimited | Get-MailboxStatistics | Sort-Object LastLogonTime -Descending | select DisplayName, LastLogonTime
Get-User -resultsize unlimited | Get-MailboxStatistics | Sort-Object DisplayName -Descending | select DisplayName, LastLogonTime
Get-User -resultsize unlimited | Get-MailboxStatistics | Sort-Object LastLogonTime -Descending | select DisplayName, LastLogonTime >C:\Scripts\LastLogonTime.txt
Get-User -resultsize unlimited | Get-MailboxStatistics | Sort-Object LastLogonTime -Descending | select DisplayName, LastLogonTime | Out-File c:\Scripts\LastLogonTime.csv