Checking active users in Office365

When an administrator logs in on Office365 a dashboard tells the user that there are x amount of users who haven't logged for more than 30 days. Clicking on this link allows you to view the information in graphs, tables, large graphs, but no way it shows you the names of the inactive users.

Venus Mi has given the answer to this in his forum post, but refers to another page as well for connecting to Office365 via Powershell. Following these instructions will lead you to the following error:
cannot be loaded because the execution of scripts is disabled on this system. Please see "get-
help about_signing" for more details.

Luckily this can be solved as well, thanks to the powershell owners manual. Finally you'll run in the last error which is answered by spiritX:
Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\M icrosoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied

So, how can one find out which office365 users haven't logged in recently?
- start Powershell AS ADMINISTRATOR (right click and "run as administrator")
- Execute the following script:

Set-ExecutionPolicy RemoteSigned
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-mailbox -resultsize unlimited| Get-MailboxStatistics | select displayname, lastlogontime
Remove-PSSession $Session

This will give you a popup where you should enter your Office365 credentials. After this you'll get a list of all users with their last logon date.


No comments: