Blog Post

Exchange Team Blog
2 MIN READ

Updated: Running PowerShell cmdlets for large numbers of users in Office 365

The_Exchange_Team's avatar
Nov 11, 2019

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

Updated Nov 12, 2019
Version 2.0
  • Bhargav705's avatar
    Bhargav705
    Copper Contributor

    The_Exchange_Team  -When I am trying to install the module, I get an error as below.

     

    PS C:\WINDOWS\system32> Start-RobusCloudCommand
    Start-RobusCloudCommand : The term 'Start-RobusCloudCommand' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + Start-RobusCloudCommand
    + ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Start-RobusCloudCommand:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    PS C:\WINDOWS\system32>

  • Aussupport30's avatar
    Aussupport30
    Copper Contributor

    Hi All,

     

      How do i run the below command?

     

    Get-Mailbox -ResultSize unlimited -RecipientTypeDetails UserMailbox | Set-MailboxJunkEmailConfiguration -TrustedSendersAndDomains @{add="test@domain.com ","test2@domain.com "}

  • DanFlorea's avatar
    DanFlorea
    Copper Contributor

    Hi Matthew,

    this is great!  It would be greater if the RobustCloudCommand would work with certificate based authentication (AppID/thumbprint), so it can be fully used in automations.

     

    Thanks,

    Dan

     

  • timbauer132's avatar
    timbauer132
    Copper Contributor

    Hi! I installed the module via powershell command. It works fine except for one thing: When inserting the parameter -Credential , the script fails saying that „the parameter does not exist“. How can I include it correctly?

    Kind regards

    Tim

  • TechAgent's avatar
    TechAgent
    Copper Contributor

    how to use Start-RobustCloudCommand.ps1 with existing script.

     

    I have one powershell script xyz.ps1. how to use robustcloud script with them.

  • EvanAlmighty's avatar
    EvanAlmighty
    Copper Contributor

    Fantastic, I've been struggling to update permissions on a large number of O365 public folders via EXOPS, and I think this will do the trick.

    Thanks for publicizing it! I will try it out ASAP! 

  • Jacob Reinhardt's avatar
    Jacob Reinhardt
    Copper Contributor

    This is great, thank you! I had just worked to modify the existing one to use the MFA version, and it was working well but this will be even better.