<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Office 365 mobile devices Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/office-365-mobile-devices/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/office-365-mobile-devices/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Thu, 12 Nov 2020 04:41:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>Get Mobile Device Statistics In Exchange Online Using Powershell</title>
		<link>https://thesysadminchannel.com/get-mobile-device-statistics-in-exchange-online-using-powershell/</link>
					<comments>https://thesysadminchannel.com/get-mobile-device-statistics-in-exchange-online-using-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Fri, 07 Aug 2020 06:56:27 +0000</pubDate>
				<category><![CDATA[Exchange Online]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[azure device info]]></category>
		<category><![CDATA[Get Mobile Device Statistics]]></category>
		<category><![CDATA[Office 365 mobile devices]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2455</guid>

					<description><![CDATA[<p>Recently I was checking out my Azure tenant to see which mobile devices are currently in play. This reason for this was to see if there were any stale devices that can be deleted or if there were devices of&#8230; <a href="https://thesysadminchannel.com/get-mobile-device-statistics-in-exchange-online-using-powershell/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/get-mobile-device-statistics-in-exchange-online-using-powershell/">Get Mobile Device Statistics In Exchange Online Using Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Recently I was checking out my <a href="https://thesysadminchannel.com/azure/" rel="noopener noreferrer" target="_blank">Azure</a> tenant to see which mobile devices are currently in play.  This reason for this was to see if there were any stale devices that can be deleted or if there were devices of a certain type that I wanted to filter.  For this I would use the <strong>Get-MobileDevice</strong> and <strong>Get-MobileDeviceStatistics</strong> cmdlets to, well&#8230; Get Mobile Device Statistics in Powershell.</p>
<h2>Prerequisites</h2>
<p>One of the prerequisites you&#8217;ll need to in order to make this happen is to <a href="https://thesysadminchannel.com/how-to-install-exchange-online-powershell-module/" rel="noopener noreferrer" target="_blank">install the Exchange Online module</a>.  Luckily it&#8217;s not too difficult if you follow the linked article. Another requirement is the account you&#8217;re using must have the Exchange Administrator role to be able to query Exchange Online.</p>
<p>So in short, here is what you&#8217;ll need.</p>
<ul>
<li><strong>Exchange Online Management</strong> Module</li>
<li><strong>Exchange Administrator</strong> or <strong>Global Administrator</strong> Role</li>
</ul>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2020/11/Exchange-Admin-Role-in-Azure.png" target="_blank" rel="noopener noreferrer"><img fetchpriority="high" decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2020/11/Exchange-Admin-Role-in-Azure.png" alt="Exchange Admin Role in Azure" width="952" height="486" class="aligncenter size-full wp-image-2491" srcset="https://thesysadminchannel.com/wp-content/uploads/2020/11/Exchange-Admin-Role-in-Azure.png?v=1605136313 952w, https://thesysadminchannel.com/wp-content/uploads/2020/11/Exchange-Admin-Role-in-Azure-768x392.png?v=1605136313 768w" sizes="(max-width: 952px) 100vw, 952px" /></a><br />
&nbsp;</p>
<h2>Get Mobile Device Statistics Using Powershell</h2>
<p>Alright now that we know what we need, let&#8217;s look at how to extract that information from Exchange Online.  As mentioned we will be using the Get-MobileDevice cmdlet along with the Get-MobileDeviceStatistics to get the different properties. Get-MobileDevice has a mailbox parameter so we can filter devices that are associated with a mailbox, assuming you only wanted a single user&#8217;s device. Let&#8217;s look at what that looks like in the shell.</p>
<pre class="brush: powershell; title: ; notranslate">
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName exchangeAdmin@thesysadminchannel.com

Get-MobileDevice -Mailbox pcontreras | select @{Name = 'Identity' ; Expression = {$_.Identity -replace &quot;\\.+&quot;}}, `
DeviceId, IsManaged, IsCompliant, DeviceOS, DeviceType, FriendlyName, `
DeviceUserAgent, FirstSyncTime, DeviceAccessState, DeviceAccessStateReason, ClientType -First 1

Identity                : Paul Contreras
DeviceId                : D1151F256364422E827C79AF3D3B2230
IsManaged               : False
IsCompliant             : False
DeviceOS                : iOS 13.7
DeviceType              : Outlook
FriendlyName            :
DeviceUserAgent         : Outlook-iOS/2.0
FirstSyncTime           : 9/12/2020 2:43:42 AM
DeviceAccessState       : Allowed
DeviceAccessStateReason : ExternallyManaged
ClientType              : Outlook

</pre>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-MobileDevice-cmdlet-output.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-MobileDevice-cmdlet-output.png" alt="Get-MobileDevice cmdlet output" width="1118" height="492" class="aligncenter size-full wp-image-2495" srcset="https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-MobileDevice-cmdlet-output.png?v=1605138861 1118w, https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-MobileDevice-cmdlet-output-1024x451.png?v=1605138861 1024w, https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-MobileDevice-cmdlet-output-768x338.png?v=1605138861 768w" sizes="(max-width: 1118px) 100vw, 1118px" /></a><br />
&nbsp;</p>
<p>Get Mobile Device Statistics show similar results, however, I do like the fact that it has a <strong>LastSuccessSync</strong> and <strong>LastSyncAttemptTime</strong> to see exactly how long devices have been stale.  If you&#8217;re really good with with regex, you can parse the text in the Identity property to give you just the name.  My regex game is really weak so if you know how to do that, please post it in the comments so other viewers can use it as well.</p>
<h2>Powershell Script To Get Device and Statistics</h2>
<p>Since I like to use these 2 cmdlets interchangeably, I thought it would be helpful to provide a script so you can call the Get-MobileDeviceStatistics using the GUID from Get-MobileDevice output.</p>
<pre class="brush: powershell; title: ; notranslate">
#Get all mobile devices in the org
$MobileDeviceList = Get-MobileDevice

#Alternatively, Get all mobile devices from a single user
$MobileDeviceList = Get-MobileDevice -Mailbox pcontreras@thesysadminchannel.com

foreach ($Device in $MobileDeviceList) {
    $Stats = Get-MobileDeviceStatistics -Identity $Device.Guid.toString()
    [PSCustomObject]@{
        Identity              = $Device.Identity -replace &quot;\\.+&quot;
        DeviceType            = $Device.DeviceType
        DeviceOS              = $Device.DeviceOS
        LastSuccessSync       = $Stats.LastSuccessSync
        LastSyncAttemptTime   = $Stats.LastSyncAttemptTime
        LastPolicyUpdateTime  = $Stats.LastPolicyUpdateTime
        LastPingHeartbeat     = $Stats.LastPingHeartbeat
        ClientType            = $Stats.ClientType
    }
}

Identity             : Paul Contreras
DeviceType           : Outlook
DeviceOS             : iOS 13.7
LastSuccessSync      : 9/12/2020 2:43:43 AM
LastSyncAttemptTime  : 9/12/2020 2:43:43 AM
LastPolicyUpdateTime : 9/12/2020 2:43:43 AM
LastPingHeartbeat    :
ClientType           : Outlook

Identity             : Paul Contreras
DeviceType           : iPhone
DeviceOS             : iOS 14.1 18A8395
LastSuccessSync      : 11/12/2020 2:40:02 AM
LastSyncAttemptTime  : 11/12/2020 2:40:02 AM
LastPolicyUpdateTime : 11/11/2020 6:32:40 PM
LastPingHeartbeat    : 600
ClientType           : EAS

</pre>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-Mobile-Device-Statistics-Function.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-Mobile-Device-Statistics-Function.png" alt="Get Mobile Device Statistics Function" width="1126" height="640" class="aligncenter size-full wp-image-2504" srcset="https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-Mobile-Device-Statistics-Function.png?v=1605154323 1126w, https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-Mobile-Device-Statistics-Function-1024x582.png?v=1605154323 1024w, https://thesysadminchannel.com/wp-content/uploads/2020/11/Get-Mobile-Device-Statistics-Function-768x437.png?v=1605154323 768w" sizes="(max-width: 1126px) 100vw, 1126px" /></a></p>
<p>&nbsp;</p>
<p>Alright folk,  hopefully this article was useful enough to provide you the information needed to get mobile device statistics using Powershell. Furthermore, I hope it was enough to determine which of those devices are stale and no longer in use.  This is an excellent strategy for when you want to do some spring cleaning.</p>
<p>If you like to see more cloud content, be sure to check out our <a href="https://thesysadminchannel.com/office365/" rel="noopener noreferrer" target="_blank">Office 365 Cloud Category</a> for more useful tips and tricks.  Finally, be sure to stop by our <a href="https://www.youtube.com/c/theSysadminChannel" rel="noopener noreferrer" target="_blank">Youtube Page</a> for those visual learners.</p>
<p>The post <a href="https://thesysadminchannel.com/get-mobile-device-statistics-in-exchange-online-using-powershell/">Get Mobile Device Statistics In Exchange Online Using Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/get-mobile-device-statistics-in-exchange-online-using-powershell/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2455</post-id>	</item>
	</channel>
</rss>
