I had a situation where I needed to get some device information about what was connected to my customer’s current Office365 ActiveSync environment. Luckily after searching the Internet, I found this process to be rather simple, and I thought I would put my solution up on my blog to give an example of how to do it.The code I put together focuses around using the get-mobiledevice commandlet rather than the older and eventually slated to be decommissioned get-activesyncdevice commandlet. I also added the export-csv commandlet to give me some output I could easily load into excel. If I put some extra work into it, I could make a native export to Excel, but I was doing a quick and dirty dump of the data.To kick things off, we need to connect to Office365 so the following code I copied intact from TechNet: https://technet.microsoft.com/library/jj984289(v=exchg.160).aspx*Make sure to open the PowerShell ISE or shell as an administrator.Set-ExecutionPolicy RemoteSigned$UserCredential = Get-Credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirectionImport-PSSession $SessionYou should be prompted with a login prompt to connect with your Office365 credentials at this point. The next line is where I pull out specific information about what is connected to ActiveSync.get-mobiledevice | select deviceid,mobileoperator,id,deviceos,deviceimei,DeviceTelephoneNumber | export-csv C:Activesync.csvIn the end, I make sure to disconnect my session if I decide to do further work with a different tenant.Remove-PSSession $SessionI’ve added a

source url