No one has responded to this discussion for at least a year, so this information may be out of date. If you're looking for information about this topic, please search for a more recent discussion or post a new question.

Remote O365 PowerShell session is missing Exchange data types

This question is not answered This question is not answered

I'm attempting to adapt a variety of PowerShell scripts that were used for on-premises Exchange 2010 administration to work with Office365.

I modified the scrips to import a remote powershell session (previously run with exchange management tools as a domain member) and am finding discrepancies between the two environments. There are many examples for I'll list one for simplicity.

When running cmdlet Get-CASMailbox on-premises it returns objects of type 'Microsoft.Exchange.Data.Directory.Management.CASMailbox' however when run against O365 it returns 'System.Management.Automation.PSCustomObject'

The mailbox's 'ExchangeVersion' property, when queried on-premises, is of type 'Microsoft.Exchange.Data.ExchangeObjectVersion' however is a String using O365.

This means that on-premises code can query Mailbox.ExchangeVersion.ExchangeBuild but this property does not exist when the code is run against O365.

I tried this on a box with the exchange management tools installed and also tried loading Microsoft.Exchange.Data.dll then casting to the correct data type but didn't have any success.

What solutions exist to use O365 and have return values with the appropriate data type? Trying to parse everything as a string is going to be problematic at best.

All Replies
  • Here are a list of the Remote Powershell cmdlets for Office 365

    Not all of the native commands will be available in Remote Powershell, as well as there are some Office 365 specific commands. During the beta process, not all commands may be active.


    Dennis Armstrong

    Office 365 Support Engineer

  • Thanks for the post dennis however this isn't an issue of a missing command. The problem is that the datatypes returned by the same cmdlets are different whether run on-premises or with remote powershell via O365.

  • HEre is the developers guide:


    That is as close to the answer  can get you. Because this is Exchange on Azure (the cloud), the exchnage attribute is converted to a string instead of the native data type. I do not have a list of what attributes are converted. Many of these conversaions happen during the Dirsync process.