首页 > 解决方案 > New-ExoPSSession:unknown_user_type:未知用户类型

问题描述

使用 PowerShell 连接到 Exchange 365 为自定义域设置 DKIM

我对 Office 365 为一堆自定义域设置 DKIM 感到非常沮丧。我需要使用 PowerShell 登录到 Exchange 系统,并使用只有 Microsoft 可以发明的语法做一些巫术。

这些是我的资源:

https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module

https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps

安装依赖

Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.3
Set-ExecutionPolicy RemoteSigned
Import-Module ExchangeOnlineManagement

我对所有问题的回答都是肯定的,这似乎有效。

在登录

$UserCredential = Get-Credential

我被要求提供我的管理员凭据,我在表单中输入它们,user@cortoso.onmicrosoft.com我也尝试了user@customdomain.com。当我通过 Microsoft 门户网站登录到 Exchange 管理员时,两者都可以工作。

下一个命令失败:

Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true -ExchangeEnvironmentName O365GermanyCloud

----------------------------------------------------------------------------
The module allows access to all existing remote PowerShell (V1) cmdlets in addition to the 9 new, faster, and more reliable cmdlets.

|--------------------------------------------------------------------------|
|    Old Cmdlets                    |    New/Reliable/Faster Cmdlets       |
|--------------------------------------------------------------------------|
|    Get-CASMailbox                 |    Get-EXOCASMailbox                 |
|    Get-Mailbox                    |    Get-EXOMailbox                    |
|    Get-MailboxFolderPermission    |    Get-EXOMailboxFolderPermission    |
|    Get-MailboxFolderStatistics    |    Get-EXOMailboxFolderStatistics    |
|    Get-MailboxPermission          |    Get-EXOMailboxPermission          |
|    Get-MailboxStatistics          |    Get-EXOMailboxStatistics          |
|    Get-MobileDeviceStatistics     |    Get-EXOMobileDeviceStatistics     |
|    Get-Recipient                  |    Get-EXORecipient                  |
|    Get-RecipientPermission        |    Get-EXORecipientPermission        |
|--------------------------------------------------------------------------|

To get additional information, run: Get-Help Connect-ExchangeOnline or check https://aka.ms/exops-docs

Send your product improvement suggestions and feedback to <cut>. For issues related to the module, contact Microsoft support. Don't use the feedback alias for problems or support issues.
----------------------------------------------------------------------------

New-ExoPSSession : unknown_user_type: Unknown User Type.
In C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.3\ExchangeOnlineManagement.psm1:426 Zeichen:30
+ ... PSSession = New-ExoPSSession -ExchangeEnvironmentName $ExchangeEnviro ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-ExoPSSession], Exception
    + FullyQualifiedErrorId : System.Exception,Microsoft.Exchange.Management.ExoPowershellSnapin.NewExoPSSession

如何继续登录 Exchange 以设置 DKIM 密钥?

标签: powershelloffice365exchange-server

解决方案


命令在没有ExchangeEnvironmentName

Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true

所需的用户是user@customdomain.com.


推荐阅读