Passing PSRemotingJob Object as Parameter in Powershell 4.0
<p>I'm writing a Powershell Cmdlet for which I need to pass in a <code>PSRemotingJob</code>
object as a parameter.  The <a href="https://stackoverflow.com/help/mcve">MCVE</a> follows:</p>

<pre><code>function My-Cmdlet {
    [CmdletBinding()]
    Param(
        [Parameter(Position=0,
                   Mandatory=$true,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [PSRemotingJob[]]$Job
    )

    BEGIN {}

    PROCESS {
        ForEach ($j in $Job) {
            $j
        }
    }

    END {}
}
</code></pre>

<p>The issue is that when I pass a job into the cmdlet, I get an error, as follows:</p>

<pre><code>PS C:\Temp&gt; Invoke-Command -AsJob -CN svr001 -Command {Start-Sleep 10} | My-Cmdlet
My-Cmdlet : Unable to find type [PSRemotingJob]. Make sure that the assembly that contains this type is loaded.
At line:1 char:63
+ Invoke-Command -AsJob -CN svr001 -Command {Start-Sleep 10} | My-Cmdlet
+                                                              ~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (PSRemotingJob:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

PS C:\Temp&gt;
</code></pre>

<p>I realize that this should be a simple matter of substituting the correct object
type or fully-qualified object, but I've also tried using
<code>[System.Management.Automation.PSRemotingJob]</code> with the same results.</p>

<p>I'm using Powershell 4.0.</p>