当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] Get-MSOLUser:找不到位置参数

作者:精品下载站 日期:2024-12-14 20:55:33 浏览:15 分类:玩电脑

Get-MSOLUser:找不到位置参数


[玩转系统] Get-MSOLUser:找不到位置参数

错误消息“找不到接受参数 [用户名] 的位置参数”很可能是启动 Office 365 PowerShell 时遇到的第一个错误:

PS C:\> Get-MsolUser [email protected]
Get-MsolUser : A positional parameter cannot be found that accepts argument
  '[email protected]'.
At line:1 char:1
+ Get-MsolUser [email protected]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-MsolUser],
    ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,
    Microsoft.Online.Administration.Automation.GetUser

此错误消息的修复非常简单:

运行 Get-MSOLUser 命令时始终使用“-UserPrincipalName”作为第一个参数:

PS C:\> Get-MsolUser -UserPrincipalName [email protected]

UserPrincipalName                    DisplayName          isLicensed
-----------------                    -----------          ----------
[email protected] morten skrubbeltrang True

或者,如果要搜索 Azure AD 用户的多个实例,可以使用 SearchString 参数,例如:

PS C:\> Get-MsolUser -SearchString "Brahe"

UserPrincipalName                         DisplayName  isLicensed
-----------------                         -----------  ----------
[email protected] Tycho Brahe  False
[email protected]      Thomas Brahe False

此命令将在 DisplayName 或 EmailAddress 中搜索提供的字符串。

PowerShell MSOnline 模块

Get-MSOLUser 命令是 MSOnline PowerShell 模块的一部分。

在许多情况下,您最终可能会同时安装多个版本的 MSOnline 模块。对正在加载的模块进行故障排除可能会非常令人困惑。

另外,在某些情况下,模块本身的安装会引起一些麻烦。

如果您想了解有关此模块的安装和故障排除的更多信息,请查看本文。它包含 PowerShell 中模块加载顺序的完整说明。

轻松的 Office 365 管理

要完全跳过使用 MSOnline PowerShell 模块的需要,您应该看看 Easy365Manager。

Easy365Manager 作为熟悉的 AD 用户和计算机工具的扩展。借助 Easy365Manager,您可以使用本机本地 AD 用户管理工具配置 Office 365 许可证和邮箱。无需经常登录 AD Azure 门户和 Exchange 管理中心。

Easy365Manager 还使您能够摆脱本地 Exchange Server。这可以让您在短时间内节省大量时间和金钱。

在此下载免费且功能齐全的 30 天试用版。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯