无法在PowerShell上导入MSOnline(Connect-MsolService错误)

时间:2013-04-15 15:12:04

标签: windows powershell azure 64-bit cmdlets

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

  

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

6 个答案:

答案 0 :(得分:61)

在审核了Microsoft的TechNet文章"Azure Active Directory Cmdlets" -> section "Install the Azure AD Module"之后,幸运的是,这个过程似乎已经大大简化了。

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

  1. 适用的操作系统:Windows 7至10
    名称:“面向IT专业人员RTW的Microsoft Online Services登录助手”
    版本:7.250.4556.0(最新)
    安装人员网址: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
    安装人员网址:https://technet.microsoft.com/en-us/library/dn975125.aspx
    安装程序文件名:AdministrationConfig-en.msi
  3. 适用的操作系统:Windows 7
    名称:“Windows PowerShell 3.0”
    版本:3.0(以后的版本可能也会起作用)
    安装人员网址:https://www.microsoft.com/en-us/download/details.aspx?id=34595
    安装程序文件名:Windows6.1-KB2506143-x64.msu
  4. enter image description here enter image description here enter image description here

答案 1 :(得分:22)

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

<强> [溶液] 我为解决这个问题所做的是:

从源

复制名为MSOnlineMSOnline Extended的文件夹
  

C:\ Windows \ System32下\ WindowsPowerShell \ V1.0 \模块\

到文件夹

  

C:\的Windows \ Syswow64资料\ WindowsPowerShell \ V1.0 \模块\

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

答案 2 :(得分:1)

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

答案 3 :(得分:1)

我使用的是较新版本的SPO Management Shell。为了让错误消失,我改变了我的Import-Module语句:

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

我也使用更新的命令:

Connect-SPOService

答案 4 :(得分:0)

使用一个易于使用的脚本连接到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 :(得分:-2)

需要以下内容:

  • 需要下载并安装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) - &gt;复制文件夹MSOnline; (2)如此处所见

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

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