How to Fix the ‘Connect-MicrosoftTeams’ Could Not be Loaded error

This post is about fixing Microsoft Teams PowerShell error: The ‘Connect-MicrosoftTeams’ command was found in the module ‘MicrosoftTeams’, but the module could not be loaded. For more Information, run “Import-Module MicrosoftTeams”.

The Initial Error

Tried uninstall and install again but not helping, we can see the module is correctly installed


PS C:\Windows\system32> Uninstall-Module MicrosoftTeams -AllVersions -Force
PS C:\Windows\system32> Install-Module MicrosoftTeams -MinimumVersion "2.0.0"-AllowClobber

PS C:\Windows\system32>  Get-Module -ListAvailable -Name MicrosoftTeams

Now we run “import-module MicrosoftTeams”, we found the root cause “running scripts is disabled on this system

PS C:\Windows\system32> import-module MicrosoftTeams

The Fix

The fix is very straightforward: change the execution policy

PS C:\Windows\system32> Set-ExecutionPolicy Unrestricted

Useful Link

https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install

1 thought on “How to Fix the ‘Connect-MicrosoftTeams’ Could Not be Loaded error”

  1. Arian van der Pijl

    Hi there,
    My suggestion is to choose ‘RemoteSigned’
    This still allows to run local scripts but not (unintentionally) downloaded scripts.
    So a slightly more secure option.
    Thanks for the writeup that let me to dig deeper on this subject.

Leave a Comment

Your email address will not be published. Required fields are marked *