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

[玩转系统] Get-UnifiedGroup:术语“Get-UnifiedGroup”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。

作者:精品下载站 日期:2024-12-14 15:57:06 浏览:13 分类:玩电脑

Get-UnifiedGroup:术语“Get-UnifiedGroup”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。


问题:获取“Get-UnifiedGroup:术语“Get-UnifiedGroup”未被识别为 cmdlet 的名称、函数、脚本文件或可运行程序。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。”PowerShell 中出现错误!

[玩转系统] Get-UnifiedGroup:术语“Get-UnifiedGroup”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。

根本原因及解决方案:

在使用与 Microsoft 365 组交互的 Get-UnifiedGroup 或 Set-UnifiedGroup cmdlet 之前,必须连接到 Exchange Online。

解决方案 1:安装 Exchange Online PowerShell 模块!

Get-UnifiedGroup cmdlet 是 Exchange 管理模块的一部分,您的系统中可能未安装它!因此,要解决此问题,您必须先安装 PowerShell 的 Exchange Online 模块并连接到 Exchange Online。


#Install Exchange Online Management Shell
Install-Module -Name ExchangeOnlineManagement

#Connect to Exchange Online
Connect-ExchangeOnline

#Run Get-UnifiedGroup
Get-UnifiedGroup

解决方案 2:创建并导入 PSSession

如果没有 Exchange Online 管理模块,您可以使用 PSSession 连接到 Exchange Online。但是,PSSession 方法很快就会被弃用。


$Credential = Get-Credential

#Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
           -Credential $Credential -Authentication Basic -AllowRedirection

#Import the session
Import-PSSession $Session -DisableNameChecking
 
#Get all Office 365 Group
Get-UnifiedGroup

类似的解决方案也适用于“set-unifiedgroup 不是可识别的 cmdlet”错误。

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

取消回复欢迎 发表评论:

关灯