windows 导入模块:未加载指定的模块“msonline”,因为在任何模块目录中都找不到有效的模块文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32829788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:17:21  来源:igfitidea点击:

Import-Module : The specified module 'msonline' was not loaded because no valid module file was found in any module directory

windowspowershellazuremodule

提问by kevin

Error :

错误 :

Import-Module : The specified module 'msonline' was not loaded because no valid module file was found in any module directory

The error pops up when I try to load the module by typing :

当我尝试通过键入以下内容加载模块时弹出错误:

Import-Module MSOnline

tried to install the Azure AD powershell module on my computer so I'd be able to make PSSession using the MSONLINE cmdlets.

尝试在我的计算机上安装 Azure AD powershell 模块,以便我能够使用 MSONLINE cmdlet 进行 PSSession。

After I installed the Microsoft Online Services Sign-in Assistant (version7.250.4556.0) and then installed the latest Windows Azure AD Module for Windows Powershell, I get the above error in the title.

在我安装了 Microsoft Online Services 登录助手(版本 7.250.4556.0),然后为 Windows Powershell 安装了最新的 Windows Azure AD 模块后,我在标题中收到了上述错误。

I can do following cmd and get output :

我可以执行以下 cmd 并获得输出:

(get-item C:\Windows\System32\WindowsPowerShell\v1.0\Modules\MSOnline\Microsoft.Online.Administration.Automation.PSModule.dll).VersionInfo.FileVersion

Output : 1.0.8362.1

输出: 1.0.8362.1

I was originally following this guide :

我最初是按照本指南:

https://onlinehelp.coveo.com/en/ces/7.0/administrator/installing_the_windows_azure_ad_module_for_windows_powershell.htm

https://onlinehelp.coveo.com/en/ces/7.0/administrator/installing_the_windows_azure_ad_module_for_windows_powershell.htm

I can confirm on another computer where this Module is working fine that the files in the path (where the module files should reside) are the same as my computer that isn't working :

我可以在此模块正常工作的另一台计算机上确认路径中的文件(模块文件应驻留的位置)与我的不工作的计算机相同:

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

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

I've already rebooted after installation. I've tried to install different version of the Azure AD Module from hereto no avail.

安装后我已经重新启动了。我试图从这里安装不同版本的 Azure AD 模块,但无济于事。

Hardware/Software Version info :
Computer : Microsoft Surface Pro 3
OS Version : Windows 8.1 64-bit
PowerShell Version : Major 4Minor 0Build -1Revision -1

硬件/软件版本信息:
计算机:Microsoft Surface Pro 3
操作系统版本:Windows 8.1 64 位
PowerShell 版本:Major 4Minor 0Build -1Revision -1

Any help with this is greatly appreciated.

非常感谢您对此的任何帮助。

回答by kevin

I found out the issue.

我发现了这个问题。

There are 2 binaries that you need to install to get this working :

您需要安装 2 个二进制文件才能使其正常工作:

  • Microsoft Online Services Sign-In Assistant for IT Professionals RTW
  • Azure Active Directory Module for Windows PowerShell
  • 面向 IT 专业人员的 Microsoft 在线服务登录助手 RTW
  • 适用于 Windows PowerShell 的 Azure Active Directory 模块

Both of these need to be the 64bit version to work together (in my case since I have a x64bit OS).

这两个都需要是 64 位版本才能一起工作(在我的情况下,因为我有一个 x64 位操作系统)。

When I was trying to install the Online Services Sign-In Assistant through IE it kept giving me the 32bit MSI, even though I was asking for the 64bit installer.

当我尝试通过 IE 安装在线服务登录助手时,它一直给我 32 位 MSI,即使我要求的是 64 位安装程序。

I realized this after I tried to save the file, instead of just hitting RUN on the download.

我在尝试保存文件后意识到这一点,而不仅仅是在下载时点击 RUN 。

Once I switched to chrome I was able to download the 64bit version.

一旦我切换到 chrome,我就可以下载 64 位版本。

After I had the 64bit version of both binaries installed everything worked as expected.

在我安装了两个二进制文件的 64 位版本后,一切都按预期工作。