Exchange 2013 and Deprecated PowerShell Get Commands

One of my pet peeves when it comes to PowerShell is to write a good script that does what I need with the commands I have at my disposal, only to find the command deprecated in some future release of Exchange. Usually the only way to find out is run a proper query with the command and receive a warning about the pending deprecation:

Deprecation1

While I understand that things change and Microsoft needs to modify their product to match the times, it can be frustrating for those of us on the front lines that now need to rewrite their scripts to make them useful in future versions.

What Commands are Deprecated
There is no definitive list of commands that are being deprecated by Microsoft. As such, I decided to see if I could discover all of the commands that are changing so that you can be prepared and I can be prepared to change scripts for future ‘proofing’. For this article, I have limited my scope to the Get Commands:

ActiveSync Command Changes

  • Get-ActiveSyncDevice is being replaced with Get-MobileDevice
  • Get-ActiveSyncDeviceStatistics is being replaced with Get-MobileDeviceStatistics
  • Get-ActiveSyncMailboxPolicy is being replaced with Get-MobileDeviceMailboxPolicy

The problem with these changes is a lack of consistency with ActiveSync Commands. Some are changing, while others are not. These commands are not changing, yet are from the same family of commands:

  • Get-ActiveSyncDeviceAccessRule
  • Get-ActiveSyncDeviceAutoblockThreshold
  • Get-ActiveSyncDeviceClass
  • Get-ActiveSyncOrganizationSettings
  • Get-ActiveSyncVirtualDirectory

So why not make the new root of these commands get-mobiledevice? Of course, that would also require a future IIS change with a new vDir for mobile devices to connect to….

Get-Help for each command reveals the reasoning for the command changes. As Microsoft expands its mobile offerings on other mobile platforms (iPad, Surface, etc.) ActiveSync has become just another way for a mobile device to connect.

Notice the base settings included in the get-activesyncdevice cmdlet:

Get-ActiveSyncDevice

Now with the get-mobiledevice there are references to selecting either ActiveSync or OWAforDevices as options:

Get-MobileDevice-Changes

With these switches you can more effective check devices of different types as they sync with your Exchange 2013+ servers.

Similar to the Get-MobileDevice command, the Get-MobileDeviceStatistics also has switches for ActiveSync and OWAForDevices. The base get-activesyncdevicestatistics:

Get-ActiveSyncDeviceStatistics

The additions to the get-mobiledevicestatistics:

Get-MobileDeviceStatistics-Changes

The output from the two Device Statistics commands are only slightly different:

Get-activesyncdevicestatistics outputs the version of the device like this:

Get-activeSyncDeviceStatistics-Output

Whereas Get-mobiledevicestatistics reports it like this:

Get-MobileDeviceStatistics-Output

The biggest impact this will have is if you are querying for a certain device version, you will have to change the parameter in your script to pick up this change.

For the Get-ActiveSyncMailboxPolicy vs Get-MobileDeviceMailboxPolicy cmdlets, we see that there are more options revealed as to what can be set on these devices:

MailboxPolicyChanges

Most of the changes are just a new name for the same data. However, IsDefaultPolicy is removed (perhaps because there is a setting called IsDefault already) and parameters called AllowGooglePushNotifications and AllowMicrosoftPushNotifications are added (AllowApplePushNotifications is already present) to the list now. While nothing earth shattering is included, it is nice to see the three major vendors now separated for customization for Push Notification (Apple, Google and Microsoft) however anyone who has scripts based on the renamed values will need to revisit their scripts (a repeated theme here) to make sure the correct data is gathered.

One more command that is being deprecated is the ‘Get-TransportServer’ command which is being replaced by the ‘Get-TransportService’. With the change of roles from Exchange 2010 to Exchange 2013 and the removal of the Hub Transport role, this change does make sense at least from that perspective. The Hub Role is now just an integrated service and this the new PowerShell cmdlet to reflect that change. Examining the get-help for these commands reveals that this is a one for one replacement with no additional syntax changes needed:

SYNTAX
Get-TransportService [-Identity ] [-DomainController ] []
Get-TransportServer [-Identity ] [-DomainController ] []

A quick examination of all the attributes revealed by the two commands shows that they both expose the exact same attributes. Make sure if you have any handy scripts with the get-transportserver (and probably set-transportserver) that these are modified to reflect the future change in case the commands are removed in a future CU.

Further Reading
Get-MobileDevice
Get-MobileDeviceStatistics
Get-MobileDeviceMailboxPolicy
Get-TransportService

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s