Extract a list of Inactive Mobiles from Office 365

Finding a complete list of mobile devices in Office 365 that have not synced in X days can be a bit of a task through the online portal. This script will connect to your Office 365 environment and export all those mobiles that have not syncronised in the last 14 days.

 
 
 
 
 
3.8 Star
(6)
2,048 times
Add to favorites
Office 365
8/28/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Need to be fixed
    1 Posts | Last post January 09, 2014
    • $users = Get-Mailbox -ResultSize Unlimited    eats 1.5GB of memry with around 15.000 users. You need to cut down on the fields not bog down the machine.
      
      Change it to:
      $users = ( Get-Mailbox -ResultSize Unlimited | select identity,userprincipalname  )
      
      This saves me 1GB+ of memory. Still is very slow as most users does not use a mobile device. We have around 2000 users with mobile devices currently.
      
      So instead I am using:
      $alldevices = ( Get-MobileDevice -ResultSize unlimited  | select identity )
      
      And then later
      foreach ($dev in $alldevices)  { 
      	$devices =  Get-MobileDeviceStatistics -Identity $dev.identity
      ...
      
      The $dev.identity contains the closest we get to something user identifiable, as the UserDisplayName of GetMobileDevice might change over time. Taking this  up to the first / seems to yeild something that you can use with get-mailbox -identity to get full user details if needed.
      
      
      
  • Inactive Users
    1 Posts | Last post October 09, 2013
    • It is possible to separate the inactive users? 
      
      I have situations that some users may be suspended account  for using Office 365 and would like to exclude from this list.