Home

How to identify user who is using iOS / Android Outlook App

%3CLINGO-SUB%20id%3D%22lingo-sub-132672%22%20slang%3D%22en-US%22%3EHow%20to%20identify%20user%20who%20is%20using%20iOS%20%2F%20Android%20Outlook%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-132672%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHoping%20someone%20can%20help%20-%20been%20pulling%20my%20hair%20out%20on%20this%20for%20the%20last%20few%20weeks.%20Would%20anyone%20have%20a%20handy%20PS%20script%20which%20would%20identify%20which%20users%20are%20using%20the%20iOS%20%2F%20Android%20Outlook%20App.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20have%20a%20tenant%20with%20approx.%2040%2C000%20users%20in%2C%20some%20F1%2C%20E1%20and%20E3%20-%20As%20we're%20a%20enterprise%20I%20need%20a%20way%20of%20identifying%20users%20who%20are%20on%20a%20F1%20or%20E1%20licence%20and%20ask%20them%20to%20remove%20as%20F1%20%2F%20E1%20licence%20doesn't%20cover%20the%20iOS%20%2F%20Android%20Outlook%20app.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20tried%20running%20the%20Mailbox%20App%20report%20in%20the%20portal%20but%20it%20doesn't%20tell%20me%20which%20licence%20the%20user%20is%20on%20or%20really%20identify%20if%20their%20using%20the%20iOS%20%2F%20Android%20Outlook%20app.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EThanks%20for%20any%20help%20anyone%20can%20give%20in%20advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-132672%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-134086%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20identify%20user%20who%20is%20using%20iOS%20%2F%20Android%20Outlook%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-134086%22%20slang%3D%22en-US%22%3E%3CP%3E%3CBR%20%2F%3EYou%20can%20try%20below%20script%20and%20this%20script%20will%20correlate%20with%20username%2C%20license%20and%20mobile%20device%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%24cred%20%3D%20Get-Credential%0A%0A%23connecting%20Exchange%20Online%20%0A%24exchangeSession%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-ConnectionUri%20%22https%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%22%20-Credential%20%24cred%20-Authentication%20%22Basic%22%20-AllowRedirection%0AImport-PSSession%20%24exchangeSession%20-DisableNameChecking%0A%0A%23conneting%20Msolservice%0AConnect-MsolService%20-Credential%20%24cred%0A%0A%23Don't%20forget%20to%20Provide%20correct%20path%0A%24LicenseMappingPath%20%3D%20%22C%3A%5CLicmap.txt%22%0A%24content%20%3D%20(%20Get-Content%20%24LicenseMappingPath%20%7C%20Out-String%20)%0A%24licname%20%3D%20(%20Invoke-Expression%20%24content%20)%0A%0A%23get%20user%20details%20with%20license%0A%24j%3D1%0A%24user%3D%20Get-MsolUser%20-all%20%7CWhere-Object%20%7B%20%24_.isLicensed%20-eq%20%24true%20%7D%20%7Cselect%20UserPrincipalName%2CLicenses%0A%24Userdetails%20%3D%20%24user%20%7C%25%20%7B%0A%20%20%20%20%20%0A%20%20%20%20%20Write-Progress%20-Activity%20%22Get%20Users%22%20-Status%20%22%24j%25%20User%3A%22%0A%20%20%20%20%24lic%3D(%24_.Licenses.AccountSkuId)%0A%20%20%20%20%24lname%3D%20%40()%0A%20%20%20%20foreach%20(%24l%20in%20%24lic)%20%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%24l2%3D%24l.Split(%22%3A%22)%5B1%5D%0A%20%20%20%20%20%20%20%20%24Licn%3D%24licname.Item(%24l2)%20%0A%20%20%20%20%20%20%20%20%24lname%20%2B%3D%24Licn%0A%20%20%20%20%20%20%20%20%24Licn%20%3D%24null%0A%20%20%20%20%7D%0A%20%20%20%20New-Object%20-TypeName%20PSObject%20-Property%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20username%20%3D%20%24_.UserPrincipalName%0A%20%20%20%20%20%20%20%20%20%20Licence%20%3D%20%24lname%20-join%20%22%2C%22%0A%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%24lname%20%3D%20%24null%0A%20%20%20%20%24j%2B%2B%0A%7D%7Cselect%20username%2CLicence%0A%0A%23Get%20Mobile%20device%20with%20license%20details%0A%24i%3D1%0A%24Userdetails%20%7C%20%25%20%7B%0A%20%20%20%20%24Userdetail%20%3D%20%24_%0A%20%20%20%20%24mobiledetails%3D%20Get-MobileDevice%20-Mailbox%20%24_.username%20-ErrorAction%20ignore%20%7C%20select%20UserDisplayName%2CDeviceOS%0A%20%20%20%20if(%24mobiledetails.DeviceOS%20-ne%20%24null)%0A%20%20%20%20%7B%0A%20%20%20%20Write-Progress%20-Activity%20%22Get%20Mobile%20details%22%20-Status%20%22%24i%25%20Mobile%20Device%3A%22%0A%20%20%20%20%20%20New-Object%20-TypeName%20PSObject%20-Property%20%40%7B%0A%20%20%20%20%20%20%20%20%20%20UserPrincipalName%20%3D%20%24Userdetail.username%0A%20%20%20%20%20%20%20%20%20%20Licensename%20%3D%20%24Userdetail.Licence%0A%20%20%20%20%20%20%20%20%20%20Devicetype%20%3D%20%24mobiledetails.DeviceOS%0A%20%20%20%20%20%20%20%20%20%20UserDisplayName%20%3D%20%24mobiledetails.UserDisplayName%0A%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%24i%2B%2B%0A%20%20%20%20%20%7D%0A%0A%7D%20%7Cselect%20UserPrincipalName%2CLicensename%2CDevicetype%2CUserDisplayName%20%7CExport-Csv%20-Path%20%22c%3A%5CExportmobildetails.csv%22%20-NoTypeInformation%3C%2FPRE%3E%0A%3CP%3ENote%3A%20Before%20run%20the%20script%20change%20following%20vlaue%26nbsp%3B%20in%20the%26nbsp%3Bscript%3C%2FP%3E%0A%3CPRE%3E%20%24LicenseMappingPath%20%3CBR%20%2F%3E-Path%20%22c%3A%5CExportmobildetails.csv%22%20%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-132876%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20identify%20user%20who%20is%20using%20iOS%20%2F%20Android%20Outlook%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-132876%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Email%20app%20usage%20report%20in%20the%20portal%20is%20a%20good%20starting%20point.%20If%20you%20want%20the%20exact%20device%20details%2C%20you%20will%20have%20to%20use%20the%20PowerShell%20cmdlets%20(Get-MobileDevice%2C%20Get-MobileDeviceStatistics).%20As%20both%20the%20iOS%2FAndroid%20Outlook%20apps%20use%20the%20same%20method%20to%20connect%2C%20you%20should%20be%20able%20to%20easily%20filter%20just%20those%20users%2Fdevices%20via%3A%3C%2FP%3E%0A%3CPRE%3EGet-MobileDevice%20-RestApi%20-ResultSize%20unlimited%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAdding%20the%20exact%20license%20information%20will%20require%20additional%20runs%20of%20the%20Get-MsolUser%2FGet-AzureADUser%20cmdlet%20or%20correlating%20via%20the%20report%20available%20in%20the%20portal.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Deleted
Not applicable

Hi,

 

Hoping someone can help - been pulling my hair out on this for the last few weeks. Would anyone have a handy PS script which would identify which users are using the iOS / Android Outlook App.

 

We have a tenant with approx. 40,000 users in, some F1, E1 and E3 - As we're a enterprise I need a way of identifying users who are on a F1 or E1 licence and ask them to remove as F1 / E1 licence doesn't cover the iOS / Android Outlook app.

 

I've tried running the Mailbox App report in the portal but it doesn't tell me which licence the user is on or really identify if their using the iOS / Android Outlook app.


Thanks for any help anyone can give in advance.

2 Replies

The Email app usage report in the portal is a good starting point. If you want the exact device details, you will have to use the PowerShell cmdlets (Get-MobileDevice, Get-MobileDeviceStatistics). As both the iOS/Android Outlook apps use the same method to connect, you should be able to easily filter just those users/devices via:

Get-MobileDevice -RestApi -ResultSize unlimited

 

Adding the exact license information will require additional runs of the Get-MsolUser/Get-AzureADUser cmdlet or correlating via the report available in the portal.


You can try below script and this script will correlate with username, license and mobile device

 

$cred = Get-Credential

#connecting Exchange Online 
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $cred -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking

#conneting Msolservice
Connect-MsolService -Credential $cred

#Don't forget to Provide correct path
$LicenseMappingPath = "C:\Licmap.txt"
$content = ( Get-Content $LicenseMappingPath | Out-String )
$licname = ( Invoke-Expression $content )

#get user details with license
$j=1
$user= Get-MsolUser -all |Where-Object { $_.isLicensed -eq $true } |select UserPrincipalName,Licenses
$Userdetails = $user |% {
     
     Write-Progress -Activity "Get Users" -Status "$j% User:"
    $lic=($_.Licenses.AccountSkuId)
    $lname= @()
    foreach ($l in $lic) 
    {
        $l2=$l.Split(":")[1]
        $Licn=$licname.Item($l2) 
        $lname +=$Licn
        $Licn =$null
    }
    New-Object -TypeName PSObject -Property @{
          username = $_.UserPrincipalName
          Licence = $lname -join ","
           }
    $lname = $null
    $j++
}|select username,Licence

#Get Mobile device with license details
$i=1
$Userdetails | % {
    $Userdetail = $_
    $mobiledetails= Get-MobileDevice -Mailbox $_.username -ErrorAction ignore | select UserDisplayName,DeviceOS
    if($mobiledetails.DeviceOS -ne $null)
    {
    Write-Progress -Activity "Get Mobile details" -Status "$i% Mobile Device:"
      New-Object -TypeName PSObject -Property @{
          UserPrincipalName = $Userdetail.username
          Licensename = $Userdetail.Licence
          Devicetype = $mobiledetails.DeviceOS
          UserDisplayName = $mobiledetails.UserDisplayName
           }
           $i++
     }

} |select UserPrincipalName,Licensename,Devicetype,UserDisplayName |Export-Csv -Path "c:\Exportmobildetails.csv" -NoTypeInformation

Note: Before run the script change following vlaue  in the script

 $LicenseMappingPath 
-Path "c:\Exportmobildetails.csv"