【问题标题】:MSOnline can't be imported on PowerShell (Connect-MsolService error)无法在 PowerShell 上导入 MSOnline(Connect-MsolService 错误)
【发布时间】:2013-04-07 18:39:01
【问题描述】:

我遇到了这个问题,找不到任何答案。问题是我试图使用 Azure cdmlets 通过 c# 代码连接到 O365,但我无法获得 connect-msolservice

“当您尝试在 Office 365 中运行管理 Windows PowerShell cmdlet 时出现“无法识别术语”错误”

【问题讨论】:

    标签: windows powershell azure 64-bit cmdlets


    【解决方案1】:

    经过几个小时的搜索和尝试,我发现在 x64 服务器上必须为 x64 安装 MSOnline 模块,并且一些需要运行它们的程序使用的是 x86 PS 版本,所以他们永远找不到它。

    [解决方案] 我为解决这个问题所做的是:

    从源中复制名为MSOnlineMSOnline Extended 的文件夹

    C:\Windows\System32\WindowsPowerShell\v1.0\Modules\

    到文件夹

    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\

    然后在 PS 中运行Import-Module MSOnline,它会自动获取模块:D

    【讨论】:

    • 谢谢!这正是我想要的。
    • 感谢分享!
    【解决方案2】:

    在查看了 Microsoft 的 TechNet 文章 "Azure Active Directory Cmdlets" -> section "Install the Azure AD Module" 之后,似乎这个过程已经大大简化了,谢天谢地。

    截至 2016 年 6 月 30 日,为了成功执行 PowerShell 命令 Import-Module MSOnlineConnect-MsolService,您需要安装以下应用程序(仅限 64 位):

    1. 适用操作系统:Windows 7 到 10
      名称:“适用于 IT 专业人员 RTW 的 Microsoft Online Services 登录助手”
      版本:7.250.4556.0(最新)
      安装程序 URL:https://www.microsoft.com/en-us/download/details.aspx?id=41950
      安装程序文件名:msoidcli_64.msi
    2. 适用操作系统:Windows 7 到 10
      名称:“用于 Windows PowerShell 的 Windows Azure Active Directory 模块”
      版本:未知,但最新安装程序文件的 SHA-256 哈希为 D077CF49077EE133523C1D3AE9A4BF437D220B16D651005BBC12F7BDAD1BF313
      安装程序 URL:https://technet.microsoft.com/en-us/library/dn975125.aspx
      安装程序文件名:AdministrationConfig-en.msi
    3. 适用的操作系统:Windows 7 仅限
      名称:“Windows PowerShell 3.0”
      版本:3.0(以后的版本可能也可以)
      安装程序 URL:https://www.microsoft.com/en-us/download/details.aspx?id=34595
      安装程序文件名:Windows6.1-KB2506143-x64.msu

     

    【讨论】:

    • 谢谢你这么好的解释。彻底解决了我的问题。
    • 17 个月后,您仍然需要登录助手的 BETA 版本(请参阅步骤 4 中的说明)。在 Win7 x64 上,我安装了登录助手 7.250.4303,所以无法弄清楚为什么 Azure 安装程序抱怨它需要 7.0。果然,安装Sign-In Assistant BETA 7.250.4551之后,我就可以安装Azure AD Module了。
    • #1 和#2 的“新答案”链接是相同的 URL。我相信 Azure Powershell 模块的更正链接在此处的第 1 步中:technet.microsoft.com/en-us/library/dn975125.aspx
    【解决方案3】:

    以下是必需的:

    • 需要下载并安装 MS Online Services Assistant。
    • 需要下载并安装用于 PowerShell 的 MS 在线模块
    • 在 PowerShell 中连接到 Microsoft Online

    来源:http://www.msdigest.net/2012/03/how-to-connect-to-office-365-with-powershell/

    然后 如果您运行的是 64 位计算机,请遵循此操作: 我目前正在运行 x64 操作系统(Win8 Pro)。

    从 (1) –> (2) 复制文件夹 MSOnline,如下所示

    1) C:\Windows\System32\WindowsPowerShell\v1.0\Modules(MSOnline)

    2) C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules(MSOnline)

    来源:http://blog.clauskonrad.net/2013/06/powershell-and-c-cant-load-msonline.html

    希望这会更好,可以节省一些人的时间

    【讨论】:

      【解决方案4】:

      在一个易于使用的脚本中连接到 Office 365 和 Exchange Online。

      提醒:您必须安装以下内容才能通过 PowerShell 管理 Office 365。

      Microsoft Online Services 登录助手: http://go.microsoft.com/fwlink/?LinkId=286152

      适用于 Windows PowerShell 的 Azure AD 模块 32 位 - http://go.microsoft.com/fwlink/p/?linkid=236298 64 位 - http://go.microsoft.com/fwlink/p/?linkid=236297

      可在此处找到更多信息: http://technet.microsoft.com/en-us/library/hh974317.aspx

      【讨论】:

        【解决方案5】:

        将 32 位库复制到 64 位的解决方案对我不起作用。有效的是取消选中项目属性中的 Target Platform Prefer 32-bit 复选标记。

        【讨论】:

        • 谢谢。当我尝试从托管在我的 C# 应用程序中的 PowerShell 运行空间中运行 Connect-MsolService 时,这解决了我的问题。
        【解决方案6】:

        我正在使用更新版本的 SPO 命令行管理程序。为了让错误消失,我将 Import-Module 语句更改为使用:

        Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;

        我也使用较新的命令:

        Connect-SPOService

        【讨论】:

          猜你喜欢
          • 2014-09-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-05-12
          • 1970-01-01
          • 1970-01-01
          • 2021-07-18
          • 1970-01-01
          相关资源
          最近更新 更多