首页 > 解决方案 > 找不到如何加载包含 Get-MsolUser 的库

问题描述

我尝试使用 Get-MsolUser;我收到以下消息:

Get-MsolUser : Le terme «Get-MsolUser» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou program exécutable.

用英语讲 :

Get-MsolUser:术语“Get-MsolUser”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。

如何获得包含此 cmdlet 的任何包?

标签: azurepowershellazure-active-directory

解决方案


来自:Powershell:术语“Get-MsolUser”未被识别为 cmdlet 的名称

cmdlet Get-MsolUser 属于 Azure AD Powershell (V1) 模块 (MSOnline),因此在使用此命令之前,我们需要安装并连接 MSOnline 模块。

安装 MSOnline 模块:

之前你需要下载一个可执行(exe二进制)文件来安装这个模块,但是现在微软已经使那个文件过期了,你只能通过powershell安装。使用以管理员身份运行的权限打开 Powershell 控制台并运行以下命令:

Install-Module MSOnline -Force

连接/导入 MSOnline 模块:

安装 MSOnline 模块后,运行以下命令连接 MSOnline 模块。

Connect-MsolService
# Once you connect MsolService, now run the Get-MsolUser command.
Get-MsolUser

注意:这是用于 Azure Active Directory 的旧版 MSOnline V1 PowerShell 模块。鼓励客户使用较新的 Azure Active Directory V2 PowerShell 模块而不是此模块。有关 V2 模块的详细信息,请参阅Azure Active Directory V2 PowerShell


推荐阅读