大网数据广告活动
域与目录服务

Error (The term \ is not recognized) when you try to run Azure Active Directory module for Windows PowerShell cmdlets

· 52CE 我爱测

Describes an issue in which you receive an error message when you try to run Azure Active Directory module for Windows PowerShell cmdlets. Resolutions are provided.

Original product version:   Cloud Services (Web roles/Worker roles), Microsoft Entra ID, Microsoft Intune, Azure Backup, Office 365 Identity Management
Original KB number:   2669552

Symptoms

When you try to run Microsoft Azure Active Directory module for Windows PowerShell cmdlets, you receive the following error message:

The term <cmdlet name> is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

For example, you might see the following similar message:

The term 'Connect-MsolService' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:20
+ Connect-MsolService <<<<
+ CategoryInfo : ObjectNotFound: (Connect-MsolService:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Cause

This issue can occur if the Azure Active Directory module for Windows PowerShell isn't loaded correctly.

Resolution

To resolve this issue, follow these steps.

  1. Install the Azure Active Directory module for Windows PowerShell on the computer (if it isn't already installed). To install the Azure Active Directory module for Windows PowerShell, see Manage Microsoft Entra ID using Windows PowerShell.

  2. Select Start > All Programs, select Windows Azure Active Directory, and then select Windows Azure Active Directory module for Windows PowerShell.

  3. At the Windows PowerShell command prompt, type Get-Module, and then press Enter.

  4. In the output, check that the MSOnline module is present. The output should look similar to the following one:

    Module Type Name Exported Commands
    -------------- -------- ----------------
    Binary MSOnline {Add-MsolRoleMember, Remove-MsolContact...
    

    If the MSOnline module isn't present, use Windows PowerShell to import the MSOnline module. To do it, follow these steps:

    1. Connect to Exchange Online by using remote PowerShell. For more info about how to do it, see Connect to Exchange Online Using Remote PowerShell.

    2. Type the following cmdlet, and then press Enter:

      Import-Module MSOnline
      

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 07/06/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。