title: Runspaces and Shared Objects with Methods
body: <p>There are lots of QA's and articles online explaining how to work with runspaces and shared objects' data in PowerShell using synchronization, locking, etc. But I couldn't find anything about executing method of <code>PSObject</code>, passed by <code>[reference]</code> from the main thread to another runspace. When called from within the runspace, I found that the method of the passed object executes on the <em>main</em> thread.</p>
  
  <p>Is there a way to make the method run in the runspace, other than rewriting it as a separate function and adding that function to the runspace via <code>[powershell]::Create().AddScript()</code>?</p>