I'm developing a custom PowerShell module, which I'd like to use in context of a remote session to a different computer. The following code (which obviously doesn't work) explains what I'm trying to achieve:
import-module .\MyCustomModule.psm1$session = new-pssession -computerName server01invoke-command -session $session -scriptblock { <# use function defined in MyCustomModule here #> }
The first question is whether it is at all possible to achieve this scenario? I mean I would only like my custom module to be physically present on my machine, not on remote server.
I have found this thread, but I didn't manage it to work - it doesn't allow creating a session from remote machine back to the local one. Probably, I faced with the configuration limitations mentioned somewhere in the comments to that thread... Besides, the author mentioned the performance implications which is critical for my solution...
If that's possible, then how?
The version of PowerShell is currently not a constraint - if the solution is only available in PS 3.0 - I can live with this.