排除 Exchange 命令行管理程序的故障

 

适用于: Exchange Server 2010 SP2, Exchange Server 2010 SP3

上一次修改主题: 2016-11-28

综合使用远程 Exchange 命令行管理程序与 Microsoft Exchange Server 2010 时,可能会遇到一些问题。您可以使用本主题中的信息诊断并解决客户端和连接问题。

本主题解答进行 Exchange 2010 内部安装的管理员可能会遇到的命令行管理程序相关问题。如果要为您的 Microsoft Office Outlook Web App 组织的远程命令行管理程序解决问题 ,请参阅 Windows PowerShell:管理员常见问题

客户端问题

以下各节介绍解决可能会遇到的客户端问题的技术。

Windows PowerShell 执行策略引起的脚本执行错误

尝试使用主题打开命令行管理程序中的说明打开命令行管理程序时,可能会得到以下错误消息。此错误是由于将 Windows PowerShell 中的脚本执行策略设置为 RestrictedAllSigned 而引起的。若要解决此问题,需要将脚本执行策略设置为 RemoteSigned。有关详细信息,请参阅安装 Windows Management Framework

File D:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1 cann
ot be loaded because the execution of scripts is disabled on this system. Pleas
e see "get-help about_signing" for more details.
At line:1 char:2
+ . <<<<  'D:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps
1'; Connect-ExchangeServer -auto
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

The term 'Connect-ExchangeServer' is not recognized as the name of a cmdlet, fu
nction, script file, or operable program. Check the spelling of the name, or if
 a path was included, verify that the path is correct and try again.
At line:1 char:98
+ . 'D:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Co
nnect-ExchangeServer <<<<  -auto
    + CategoryInfo          : ObjectNotFound: (Connect-ExchangeServer:String)
   [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Windows PowerShell 执行策略引起的 Import-PSSession 错误

尝试按照主题将远程 Exchange 命令行管理程序连接到 Exchange Server中的说明,使用远程命令行管理程序连接到远程 Exchange 2010 服务器时,可能会得到以下错误消息。此错误是由于将 Windows PowerShell 中的脚本执行策略设置为 RestrictedAllSigned 而引起的。若要解决此问题,需要将脚本执行策略设置为 RemoteSigned。有关详细信息,请参阅安装 Windows Management Framework

Import-Module : There were errors in loading the format data file:
Microsoft.PowerShell, , D:\Users\Administrator\AppData\Local\Temp\1\tmp_88ee1dec-ed9c-4b0c-bc3d-68ca394f6d0f_4ilp43pe.x
vh\tmp_88ee1dec-ed9c-4b0c-bc3d-68ca394f6d0f_4ilp43pe.xvh.format.ps1xml : File skipped because of the following validati
on exception: File D:\Users\Administrator\AppData\Local\Temp\1\tmp_88ee1dec-ed9c-4b0c-bc3d-68ca394f6d0f_4ilp43pe.xvh\tm
p_88ee1dec-ed9c-4b0c-bc3d-68ca394f6d0f_4ilp43pe.xvh.format.ps1xml cannot be loaded because the execution of scripts is
disabled on this system. Please see "get-help about_signing" for more details..
At line:3 char:30
+                 Import-Module <<<<  -Name $name -Alias * -Function * -Prefix $prefix -DisableNameChecking:$disableNam
eChecking -PassThru -ArgumentList @($session)
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : FormatXmlUpateException,Microsoft.PowerShell.Commands.ImportModuleCommand

将 ForEach Cmdlet 用于管道且 Cmdlet 用于其脚本块中时出错

在管道中使用 ForEach cmdlet 并且满足以下条件时,可能会得到以下错误消息:

  • ForEach cmdlet 接受来自管道中之前 cmdlet 的数据。

  • ForEach cmdlet 上的脚本块包含 cmdlet。

此错误是由于 Windows PowerShell 远程功能不支持同时运行多个管道而引起的。若要解决此问题,请将管道中之前 cmdlet 的输出以变量形式存储,然后将以变量形式存储的数据通过管道传输到 ForEach cmdlet。本示例将导致并发管道错误。

Get-Mailbox | ForEach { Set-Mailbox -ProhibitSendReceiveQuota 3GB }

将生成以下错误消息。

Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [],
   PSInvalidOperationException
    + FullyQualifiedErrorId : RemotePipelineExecutionFailed

若要解决此错误,请将 Get-Mailbox cmdlet 的输出以变量形式存储,然后将变量通过管道传输到 ForEach cmdlet,如本示例所示。

$Mailboxes = Get-Mailbox
$Mailboxes | ForEach { Set-Mailbox -ProhibitSendReceiveQuota 3GB }

安装了错误版本的 Windows PowerShell

如果未安装正确版本的 Windows PowerShell,则可能会得到以下错误消息。必须使用 Windows PowerShell 2.0(位于 Windows Management Framework 中)连接到远程 Exchange 2010 服务器。有关详细信息,请参阅安装 Windows Management Framework

如果安装了 Windows PowerShell 1.0,则可能会收到以下错误消息。

The term 'New-PSSession' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and
 try again.
At line:1 char:25
+ $Session = New-PSSession  <<<< -ConfigurationName Microsoft.Exchange -ConnectionUri http://ExchangeSrv01
/PowerShell/ -Authentication Kerberos

如果安装了 Windows PowerShell 2.0 预发行版,则可能会收到以下错误消息。

New-PSSession : Cannot bind parameter 'Authentication'. Cannot convert value "Kerberos" to type "System.Management.Auto
mation.Runspaces.AuthenticationMechanism" due to invalid enumeration values. Specify one of the following enumeration v
alues and try again. The possible enumeration values are "Default, Basic, Negotiate, NegotiateWithImplicitCredential, C
redssp".
At line:1 char:125
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://4367r10-b36/PowerShell/ -Authent
ication <<<<  Kerberos
    + CategoryInfo          : InvalidArgument: (:) [New-PSSession], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.NewPSSessionCommand

The term 'New-PSSessionOption' is not recognized as a cmdlet, function, operable program, or script file. Verify the te
rm and try again.
At D:\Program Files\Microsoft\Exchange Server\V14\bin\ConnectFunctions.ps1:220 char:27
+     $so = New-PSSessionOption <<<<  -OperationTimeout $sessionOptionsTimeout -IdleTimeout $sessionOptionsTimeout -Ope
nTimeout $sessionOptionsTimeout;
    + CategoryInfo          : ObjectNotFound: (New-PSSessionOption:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

New-PSSession : [4367r10-b36.dvktun-dom.extest.microsoft.com] Processing data from remote server failed with the follow
ing error message: The Windows Remote Shell cannot process the request; the selector value 098316FC-FBE5-4D17-B992-6530
AF1CF7F3 specified in the request was not found.
At D:\Program Files\Microsoft\Exchange Server\V14\bin\ConnectFunctions.ps1:229 char:28
+             $session = new-pssession <<<<  -connectionURI "http://$fqdn/powershell?serializationLevel=Full" -Configur
ationName Microsoft.Exchange -SessionOption $so #-erroraction silentlycontinue
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : RemoteRunspaceOpenFailed

连接问题

以下各节介绍解决可能会遇到的连接问题的技术。

用户名或密码不正确

如果指定的用户名或密码不正确,则可能会收到以下错误消息。请验证所使用的用户名和密码是否正确。

New-PSSession : [ExchServer] Connecting to remote server failed with the following error message : Access is denied.
At line:1 char:19
+ $Session = New-PSSession <<<<  -ConfigurationName Microsoft.Exchange -ConnectionUri https://ExchServer/powershell/ -Credential
$c -SessionOption $SkipCertificate
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : RemoteRunspaceOpenFailed

未对用户启用远程命令行管理程序

如果用户尝试连接到远程 Exchange 2010 服务器,但远程命令行管理程序未启用,您可能会收到以下错误消息。有关如何启用用户的远程命令行管理程序的详细信息,请参阅为用户启用远程 Exchange 命令行管理程序

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client cannot process the
request. It cannot determine the content type of the HTTP response from the destination computer. The content type is a
bsent or invalid. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

提供的服务器名称不存在

如果在远程命令行管理程序 URL 中指定的服务器名称不存在,则可能会收到以下错误消息。若要解决此问题,请验证服务器名称。有关详细信息,请参阅将远程 Exchange 命令行管理程序连接到 Exchange Server

[exchserver01] Connecting to remote server failed with the following error message : WinRM cannot process the request.
The following error occured while using Kerberos authentication: The network path was not found.
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does not exist.
  -The client and remote computers are in different domains and there is no trust between the two domains.
 After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or us
e HTTPS transport.
 Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command: winrm help config. For more information,
 see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed 

虚拟目录名称不正确

如果您连接到远程 Exchange 2010 服务器时指定了错误的虚拟目录,您可能会收到以下错误消息。若要解决此问题,请验证虚拟目录名称。有关详细信息,请参阅将远程 Exchange 命令行管理程序连接到 Exchange Server

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client received an HTTP st
atus code of 403 from the remote WS-Management service. For more information, see the about_Remote_Troubleshooting Help
 topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

运行 Import-PSSession Cmdlet 时出现警告

通过将远程 Exchange 命令行管理程序连接到 Exchange Server主题中提供的步骤连接远程 Exchange 2010 服务器时,通常会在将 Exchange 2010 cmdlet 导入到本地客户端之后看到以下警告。

WARNING: Some imported command names include unapproved verbs which might make them less discoverable.  Use the Verbose
 parameter for more detail or type Get-Verb to see the list of approved verbs.

连接到远程服务器时使用 HTTPS

如果使用 HTTPS 协议连接远程 Exchange 2010 服务器,则可能会收到一条错误消息。此错误是由于计算机不信任用于签署远程服务器使用的安全套接字层 (SSL) 证书的证书颁发机构 (CA) 而引起的。若要连接远程 Exchange 2010 服务器,必须使用 HTTP 协议和 Kerberos 身份验证方法。有关详细信息,请参阅将远程 Exchange 命令行管理程序连接到 Exchange Server

[ExchServer] Connecting to remote server failed with the following error message : The server certificate on the destin
ation computer (ExchServer:443) has the following errors:
The SSL certificate is signed by an unknown certificate authority. For more information, see the about_Remote_Troublesh
ooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

连接到远程服务器时的连接名不正确

如果在连接远程 Exchange 2010 服务器时指定的 ConnectionName 参数的值不正确,则可能会收到以下错误消息。必须对 ConnectionName 参数使用值 Microsoft.Exchange。有关详细信息,请参阅将远程 Exchange 命令行管理程序连接到 Exchange Server

[ExchServer] Connecting to remote server failed with the following error message : The WS-Management service cannot pro
cess the request. The resource URI (https://schemas.microsoft.com/powershell/MS.Exch) was not found in the WS-Management
 catalog. The catalog contains the metadata that describes resources, or logical endpoints. For more information, see t
he about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

连接到远程服务器时使用的身份验证不正确

如果在连接远程 Exchange 2010 服务器时指定 Kerberos 以外的身份验证方法,则可能会收到以下错误消息之一。若要连接远程 Exchange 2010 服务器,必须使用 Kerberos 身份验证和 HTTP 协议。有关详细信息,请参阅将远程 Exchange 命令行管理程序连接到 Exchange Server

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client cannot process the
request. CredSSP authentication is currently disabled in the client configuration. Change the client configuration and
try the request again. CredSSP authentication must also be enabled in the server configuration. Also, Group Policy must
 be edited to allow credential delegation to the target computer. Use gpedit.msc and look at the following policy: Comp
uter Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Credential
s.  Verify that it is enabled and configured with an SPN appropriate for the target computer. For example, for a target
 computer name "myserver.domain.com", the SPN can be one of the following: WSMAN/myserver.domain.com or WSMAN/*.domain.
com For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client cannot process the
request. Default credentials can be used only with Kerberos authentication or Negotiate authentication under HTTPS if t
he Allow implicit credentials for Negotiate is specified. Explicit credentials must be provided if any other authentica
tion scheme is specified. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client cannot process the
request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain,
then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. U
se winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You ca
n get more information about that by running the following command: winrm help config. For more information, see the ab
out_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client cannot process the
request. Unencrypted traffic is currently disabled in the client configuration. Change the client configuration and try
 the request again. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed

[ExchServer] Connecting to remote server failed with the following error message : The WinRM client cannot process the
request. Unencrypted traffic is currently disabled in the client configuration. Change the client configuration and try
 the request again. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportExc
   eption
    + FullyQualifiedErrorId : PSSessionOpenFailed