2

我为 Exchange 2013 服务器创建了一个New-PSSessionto a ConnectionUri,但看到会话的类型是Deserialised. 此反序列化会话不能由Invoke-CommandEnter-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".
4

0 回答 0