the [Powershell]::create() - method creates a new PowerShell-"Instance" either in the "current or a new runspace".
Can someone explain how the terms process, instance, runspace and (maybe thread) relate to each other in this regard. In laymen's terms if possible?
You can think of [Powershell]::Create() as a new powershell session on the separate thread. This session will have some default runspace created but you can change it to another one. Unlike Start-Process (separate process) and Start-Job (child process), [Powershell]::Create() is running on the same process with your main script and sharing memory space with it. This means that you can exchange actual .net objects between the main and child sessions. If sessions run on separate processes they can only exchange with textual/serialized data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With