Microsoft in recent times removed older versions of the Exchange Online PowerShell Module and many applications that were using a specific version were required to update to continue working. Many times, customers ask, how do I verify the version I have installed on my server, so I put together a small script to achieve this.

The script checks if the Exchange Online PowerShell module is installed and displays the version installed or advises that it is not installed. Below is a screenshot of the Module that it is installed:

Displaying the PowerShell Online Module version installed.

Here is the output where the Module is not installed:

Displaying a message that the PowerShell Module is not installed

Script

Below is the script you can use, nothing needs to be updated or changed and can be run from PowerShell or PowerShell ISE:

# Check if the Exchange Online PowerShell module is installed
if (Get-Module -Name ExchangeOnlineManagement -ListAvailable) {
    # Get the installed version of the Exchange Online PowerShell module
    $moduleVersion = (Get-Module -Name ExchangeOnlineManagement -ListAvailable).Version
    
    Write-Host "Exchange Online PowerShell module is installed."
    Write-Host "Version: $moduleVersion"
} else {
    Write-Host "Exchange Online PowerShell module is not installed."
}

If you want to install the Exchange Online PowerShell Module, you can do so with the command below:

Install-Module -Name ExchangeOnlineManagement

Remember to reboot your Server afterwards.

Hope it helps.

Discover more from Everything-PowerShell

Subscribe now to keep reading and get access to the full archive.

Continue reading