首页 > 解决方案 > 无法识别 Set-OrganizationConfing,即使我可以 Get-OrganizationConfig

问题描述

我正在尝试将整个组织的“重点收件箱”设置为禁用。我在网上找到了很多脚本和教程,其中大部分都指向在 PowerShell 中使用 Exchange Online Session。

例如:

我的 PS 脚本如下:

# Set up Credential
$UserCredential = Get-Credential

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

# Import the cmdlets into this session
Import-PSSession $Session -DisableNameChecking

# Get a list of the organisation's current settings
Get-OrganizationConfig

# Now set the 'Focused Inbox' option to 'off' for everyone
Set-OrganizationConfig -FocusedInboxOn $false

# Must remove the session to avoid clogging and clutter
Remove-PSSession $Session

'Get-OrganizationConfig' 命令返回当前配置的完整列表:

在此处输入图像描述

但是,当我执行“Set-OrganizationConfig”命令时,它会失败并显示以下消息:

Set-OrganizationConfig : The term 'Set-OrganizationConfig' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a 

路径已包含,请验证路径是否正确,然后重试。

在此处输入图像描述

我的假设是这是一个权限问题,但是,我可以看到所有组织的配置,并且缺少 cmdlet。

问题是什么?

我是:

标签: powershelloutlookexchange-server

解决方案


这是一个权限问题。

$Session在您的 O365 租户中使用具有全局管理员权限的帐户创建一个帐户,您将看到'Set-...'cmdlet 自动下载并插入到您的会话中。


推荐阅读