get-mobiledevicestatistics command exchange online

Welcome Forums General PowerShell Q&A get-mobiledevicestatistics command exchange online

Viewing 0 reply threads
  • Author
    Posts
    • #211029
      Participant
      Topics: 1
      Replies: 0
      Points: -9
      Rank: Member

      Need assistance with a script. The script works great, except for one thing. I cant seem to figure out how to export the primary smtp address for the mailbox. Script is below. Thank you very much for any assistance.

       

      $today = get-date -format yyyyMMdd

      $thisdevice =@()
      $incre = 0
      $o365users = import-csv C:\temp\MobileDevice\mobiledevice_$today.csv
      $o365users.count
      foreach ($item in $o365users)
      {
      $incre++
      $incre
      $item.name
      $userdevices= get-mobiledevicestatistics -mailbox $item.alias
      if($null -ne $userdevices) {
      foreach ($device in $userdevices) {
      $device=$device |Select-Object deviceos,DeviceModel,lastsuccesssync,guid
      $thisdevice+=new-object psobject -property @{loginID=$item.alias;Name=$item.name;Email=$item.primarysmtpaddress;Model=$device.devicemodel;Deviceos=$device.deviceos;lastsuccesssync=$device.lastsuccesssync;guid=$device.guid}
      #if($device.lastsuccesssync -lt (get-date).addDays(-30)){
      $device
      #remove-mobiledevice $device.guid#
      }
      }}
      $thisdevice |export-csv -append c:\temp\mobiledevice\mobiledeviceoutput_$today.csv

Viewing 0 reply threads
  • You must be logged in to reply to this topic.