Passing PSRemotingJob Object as Parameter in Powershell 4.0

Question:

I’m writing a Powershell Cmdlet for which I need to pass in a PSRemotingJob
object as a parameter. The MCVE follows:

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

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
[System.Management.Automation.PSRemotingJob] with the same results.

I’m using Powershell 4.0.

Answer:

System.Management.Automation.PSRemotingJob is not public type and thus can not be expressed in PowerShell type syntax. But you can use its base public type instead: [System.Management.Automation.Job].

Source:

Passing PSRemotingJob Object as Parameter in Powershell 4.0 by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply