This is what I would like to achieve one way or another.
I have a custom assembly defining some objects. In my script, I create a custom object that I would like to pass to the script block, preserving this behavior of the object.
Add-Type -AssemblyName MyCustomDLL
$global:object = new-object MyCustomDLL.MyCustomObject()
$object | gm
$jobWork = { param ($object) $object | gm }
$job = Start-Job -ScriptBlock $jobWork -ArgumentList $object
Wait-Job $job
Receive-Job $job
How can I do this or achieve the same effect? Thank you for your help.
source
share