Updated: Running PowerShell cmdlets for large numbers of users in Office 365
Published Nov 11 2019 12:59 PM 38.6K Views

Back in 2015 I developed a PowerShell script Start-RobustCloudCommand.ps1 to help Exchange Admins that were moving to Exchange Online and were used to running commands against large numbers of users at once.  The script has been a success with lots of positive feedback from customers who have used it to successfully run expensive operations against very large user sets.

Today I am happy to announce that Start-RobustCloudCommand is moving from a PS script to a PowerShell module.  The new RobustCloudCommand module will be easier to install and use.  It also includes support for accounts that are MFA enabled.

New Features:

  • PowerShell module RobustCloudCommand that can be installed using the built in Install-Module command.
  • Support for MFA enabled accounts.
    • Automatically renews token for as long as the window is running, and the refresh token is valid.
    • Run Start-RobusCloudCommand without “-Credential” to use with an MFA account
  • Still supports Legacy Authentication using “-Credential” for situations where it is being used by a task or other instance without MFA.
  • Source is now maintained on a public GitHub RobusCloudCommand with the MIT License.

The current implementation using ADAL v3 leverages the ADAL Dlls from the AzureAD module to call the proper .Net command to get an access token for the user and EXO PowerShell connections.  After the initial token is gathered when Start-RobustCloudCommand rebuilds the correct at 15-minute interval it will use the Refresh Token to pull a new Access Token.  Then ensures that the it can continue running without needing to further prompt the user for the MFA response.

Since the connection code involved here might be useful to other people writing scripts I broke it out into a separate PowerShell module CloudConnect.  That module is also on GitHub and I intend to expand it further to offer support for connecting to other O365 PowerShell Endpoints in an enhanced manner.

Please feel free to provide feedback on any problems that are encountered or if there is a feature that you would love to see added to either of these modules going forward.

Matthew Byrd
Escalation Engineer, Microsoft Exchange Support

Version history
Last update:
‎Nov 12 2019 12:12 PM
Updated by: