ValidateSet in JEA

I’ve just setup my first JEA end point, and set VisibleCmdLets to do a ValidateSet for Restart-Service:
VisibleCmdlets = @{ Name = ‘Restart-Service’; Parameters = @{ Name = ‘Name’; ValidateSet = ‘BITS’, ‘W3SVC’}},

I found that to be able to do Tab Completion in JEA, I need to do Implicit Remoting, which works fine. However if I try to tab complete the name parameter to see BITS or W3SVC, those don’t return, and instead it starts enumerating files from my local computer (not the JEA end point).

Does anyone know if it’s possible with the implicit remoting to tab through the ValidateSet values?


Implicit remoting is more complex. The tab completion would have to work locally, because the command isn’t sending back-and-forth to the remote machine to do that. Additionally, if the remote endpoint doesn’t provide, say, Get-Service, then there’d be no way to tab complete.

This behavior is expected. Tab Completion works by calling a function called TabExpansion2 which is disallowed by default for JEA because it in turn will call other tab completer implementations which JEA cannot ensure is safe. Best practice for interactive use of JEA is to use it via implicit remoting. Non-interactive use can use JEA directly over PSRP.

Ok, bummer.

Thanks for the quick response guys, much appreciated!