我为 Exchange 2013 服务器创建了一个New-PSSession
to a ConnectionUri
,但看到会话的类型是Deserialised
. 此反序列化会话不能由Invoke-Command
或Enter-PSSession
使用Import-PSSession
。
我该如何消费Deserialised
PSSession
?我的目标是查看Get-Queue
交换服务器的。
下面的代码:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<fqdn of exchange server>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
#Cannot convert session to non-Deserialized type
Enter-PSSession -session $Session
#Cannot convert session to non-Deserialized type
Import-PSSession -session $Session
#Cannot convert session to non-Deserialized type
icm -session $Session -ScriptBlock {Get-queue}
引发以下错误:
Cannot bind parameter 'Session'. Cannot convert the "[PSSession]Session6" value of type "Deserialized.System.Management.Automation.Runspaces.PSSession" to type "System.Management.Automation.Runspaces.PSSession".