2

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".
Luke
  • 776
  • 9
  • 24
  • if you use https:// instead of http:// is that then working for you? – BastianW Aug 23 '17 at 08:26
  • 2
    After restarting PowerShell, I got a normal (hydrated?) session object. Not sure what caused this. – Luke Aug 23 '17 at 09:42
  • 2
    Super late on this, but I got it working by just starting a new powershell instance too. Just wanted to confirm this for people popping in on this thread in the future. – wenzzzel Apr 15 '21 at 13:58

0 Answers0