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

Leave a Comment

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