I have created a New-PSSession
to a ConnectionUri
for an Exchange 2013 server, but see that the type of the session is Deserialised
. This deserialised session cannot be consumed by Invoke-Command
, Enter-PSSession
or Import-PSSession
.
How do I consume a Deserialised
PSSession
? My goal is to view the Get-Queue
of the exchange server.
The below code:
$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}
Throws the following error:
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".