Forum Discussion
Deleted
Nov 30, 2017How to identify user who is using iOS / Android Outlook App
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.
- Manidurai MohanamariappanIron Contributor
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" 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.