ExchangeOnlineManagement cmdlets not working in Runbook

John Connors (jconnors) 41 Reputation points
2025-10-28T00:51:02.94+00:00

Get-EXOMailboxStatistics: The term 'Get-EXOMailboxStatistics' is not recognized as a name of a cmdlet, function, script file, or executable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

We have an automation account.

We have imported the ExchangeOnlineManagement module in the account.

We have a runbook in the account that uses the Get-EXOMailboxStatistics cmdlet

When we test the script it returns an error:

"Get-EXOMailboxStatistics: The term 'Get-EXOMailboxStatistics' is not recognized as a name of a cmdlet, function, script file, or executable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Same issue occurs with Get-EXOMailbox

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} votes

Answer accepted by question author
  1. Bharath Y P 2,485 Reputation points Microsoft External Staff Moderator
    2025-11-19T14:58:19.76+00:00

    Hello John, apologies for the delay, we have checked with our backend team, and we got update that, since the PowerShell 7.1 and 7.2 is deprecated and are no longer supported. The recommendation is to try out PowerShell 7.4 version and use module version which is compatible with PowerShell 7.4.

    Here are the steps you can follow to update your runbook:

    Create Runtime environment

    1. Go to the Azure portal > select your Automation account.
    2. Under Process Automation > select Runtime Environments. User's image If you don't find Runtime Environments in the list, select Try Runtime environment experience in the Overview page to switch to the new portal interface. User's image Then select Runtime Environments under Process Automation.
    3. Select Create to create a new PowerShell 7.4 Runtime.
    4. On the Basics tab, provide the following details. User's image
    5. On the Packages tab, in the Package version dropdown list, you would see default Az and Azure CLI packages already present.
    6. Select +Add from gallery to add more packages from gallery and select Next. User's image
    7. On the Review + create tab, review the entries and select Create.

    A notification appears to confirm that a Runtime environment is successfully created.

    Update Runtime environment of runbook to PowerShell 7.4:

    1. Go to Azure portal > select you're In the Automation account > Runbooks page, select the runbook linked to old PowerShell Runtime environment that you want to update. Then click on Update Runtime Environment > select the new Runtime environment (PowerShell 7.4) > click update > click on refresh. You can see the Run time is update. User's image
    2. Make changes in the runbook code to ensure compatibility with PowerShell 7.4.

    You can follow the below documents that helps you to Update runbook from PowerShell 7.1 to PowerShell 7.4.

    Update PowerShell Runbook in Azure Runtime Environment - Azure Automation | Microsoft Learn

    Hope this helps, please let us know if you encounter any issue. Thanks

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.