Month: June 2021

Connect-MicrosoftTeams : The term ‘Connect-MicrosoftTeams’ is not recognized

When you run the PowerShell Connect-MicrosoftTeams on the machine for the first time, you might get the following message

Connect-MicrosoftTeams : The term ‘Connect-MicrosoftTeams’ is not recognized as the name of a cmdlet, function, script

file, or operable program

To fixe this, do the following:

Start PowerShell as Administrator and run the following command

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Filter failed to return unique result

When you try to enable a user for Teams DirectRouting and assign a LineURI to a user using a command such as the below

Set-CsUser -Identity user@domain.com -OnPremLineURI “tel:+xxxxxxxxxxxx;ext=xxxx” -EnterpriseVoiceEnabled $true -HostedVoiceMail $true

And you get the following error:

Filter failed to return unique result

This might mean that the LineURI is already assigned to another user

You need to first remove the LineURI from the other users

To remove the Line LineURI (which represents the phone number that is assigned to the user) from a user

Removing the licensing of Office 365 is not enough would disable users on Teams, but the LineURI will remain unusable

To solve the issue, you simply need to run the following on the old user

Set-CSUser olduser@domain.com -OnPremLineURI $null

The would set LineURI and the number will be free to be assigned to another

You can run to assign again the same LineURI to the another user

Set-CsUser -Identity user@domain.com -OnPremLineURI “tel:+xxxxxxxxxxxx;ext=xxxx” -EnterpriseVoiceEnabled $true -HostedVoiceMail $true


Skype for Business Online PowerShell connections is blocked.

If you try to get connected to Skype for Business Online using power shell, you will get the following message

Details: Error processing command: Processing data from remote server admin3e.online.lync.com failed with the following error message: Skype for Business Online PowerShell connections are blocked. Please replace the Skype for Business Online PowerShell connector module with the Teams PowerShell Module.

The name of the server might varies

The reason for this is that Skype for Business Online PowerShell is blocked (mostly they will not unblock them)

Use the following commands instead ( these commands utilize the Microsoft Teams PowerShell module)

First, install the Teams Module (which needs to be done only once on the machine):

Install-Module MicrosoftTeams -AllowClobber

This will download and install the module


If you do not install the module you will get the following error message”

Import-Module : The specified module ‘MicrosoftTeams’ was not loaded because no valid module file was found in any module directory.

Now, prepare the session using the following commands:

Import-Module MicrosoftTeams

$cred=Get-Credential

Connect-MicrosoftTeams -Credential $cred

The advantage of using $cred=Get-Credential is that you can use Connect-MicrosoftTeams -Credential $cred if your session expires and there is no need to supply the users id and password because the credentials are stored in the $cred variable and will remain available during the PowerShell window

But in the case of having Multi-Factor Authentication (MFA) enabled on your organization (Even if the account you are using is not enabled for MFA, you need to simply use it. Otherwise, you will get an error

Connect-MicrosoftTeams

The disadvantage of this method is that every time the session expires, you need to supply the user and password. But unfortunately, this method is not available if you have configured MFA in your organization.

So, in the case of using MFA, the following is how to prepare a new session

Import-Module MicrosoftTeams

Connect-MicrosoftTeams