Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Mobile Device Report from exchange online

$
0
0

Hi, I would like to get a report of all of the mobile device in our exchange online with following detail.

•    Full Name
•    Email Address
•    Device Type
•    Device Model – if this could display the actual model (iPhone 7,ipad, etc.) instead the “Outlook for iOS and Android” that it is displaying now, that would be great
•    Device OS
•    Phone Number
•    Device Serial Number
•    Last Sync time

All of the device are apple

I have a script which gets me the details but for some reason I cant get the Model number, Phone number and Device Serial Number.

When I run the report, in the model I see "Outlook for iOS and Android" but the model number

I remeber seing a script which you can run to tell exchange online to get/record these details.

This is the script I use to download the report.

$base = $env:USERPROFILE
$desktop = "$base/Desktop"
$date = (Get-Date).ToString('MM-dd-yyyy')
$outpath = "$desktop\MobileReport $date.csv"  ##  change this to whatever you want

$mobileReport = @()

$mailboxes = Get-Mailbox -ResultSize unlimited
$mailboxesCount = $mailboxes.count

$licensedMailboxes = $mailboxes | ? { $_.RecipientTypeDetails -eq "UserMailbox" }

foreach ($m in $licensedMailboxes)
{
    $alias = $m.alias
    $upn = $m.PrimarySmtpAddress

    $Devices = Get-MobileDevice -Mailbox $upn | select Identity
    
    $mobileDevices = @()
    foreach ($mobile in $devices)
    {
        $mobileDevices += Get-MobileDevice -Identity $mobile.identity | Select FriendlyName,DeviceID,DeviceOS,DeviceModel,isDisabled,Identity,GUID,WhenChanged
    }

        foreach ($device in $mobileDevices)
        {
            $id = $device.Identity

            $mobileStats = Get-MobileDeviceStatistics -Identity $id | Select DeviceType,LastSyncAttemptTime,LastSuccessSync,isRemoteWipeSupported,LastDeviceWipeRequestor,LastAccountOnlyDeviceWipeRequestor,DeviceAccessState

            $mobileReport += New-Object psobject -Property @{ UserPrincipalName = $upn; DeviceType = $mobileStats.DeviceType; FriendlyName = $device.FriendlyName; `
            DeviceID = $device.DeviceID; DeviceModel = $device.DeviceModel; DeviceOS = $device.DeviceOS; IsDisabled = $device.isDisabled; `
            IsRemoteWipeSupported = $mobileStats.isremotewipesupported; WhenChanged = $device.whenchanged; LastSyncAttemptTime = $mobileStats.lastsyncattempttime; `
            LastSuccessSync = $mobileStats.lastsuccesssync; LastDeviceWipeRequest = $mobileStats.lastdevicewiperequestor; DeviceAccessState = $mobileStats.DeviceAccessState; `
            GUID = $device.GUID }
        }
}

$mobileReport | select UserPrincipalName,DeviceType,FriendlyName,DeviceID,DeviceModel,DeviceOS,IsDisabled,IsRemoteWipeSupported,WhenChanged,LastSyncAttemptTime,LastSuccessSync,LastDeviceWipeRequest,DeviceAccessState,GUID | `
Export-Csv -NoTypeInformation -Path $outpath


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>