I've managed to use Import-PSSession
to create proxies to PowerShell commands (Modules, SnapIns, etc). It seems to work fine, but the syntax to avoid name collisions doesn't feel very natural.
I have a 3rd party PowerShell SnapIn containing the cmdlet Do-Stuff
. The SnapIn is installed locally, and also on remote computers A
and B
.
Is it possible to somehow import these SnapIns as (nicely named) modules so that I can call Do-Stuff
locally or on A
or B
?
What I currently have using Prefixes:
Do-Stuff #Locally
Do-OnAStuff #Invoke on A
Do-OnBStuff #Invoke on B
Or, allowing clobbering to avoid the unnatural (in my opinion) cmdlet renaming:
SnapinName\Do-Stuff #Invoke locally. Local SnapIn clobbered
tmp_h0jcyaaq.p4f\Do-Stuff #Invoke on A. Can I control module name?
tmp_rbk2rv5y.lbb\Do-Stuff #Invoke on B.
What I'd like to do:
Do-Stuff #Invoke locally
OnA\Do-Stuff #Invoke on machine A
OnB\Do-Stuff #Invoke on machine B