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 A...
Manidurai Mohanamariappan
Dec 05, 2017Iron 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"