ValidateSet in JEA

This topic contains 3 replies, has 3 voices, and was last updated by  Jerame 2 weeks, 1 day ago.

  • Author
    Posts
  • #83522

    Jerame
    Participant

    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?

    Thanks,
    Jerame

  • #83527

    Don Jones
    Keymaster

    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.

  • #83530

    Steve Lee
    Participant

    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.

  • #83537

    Jerame
    Participant

    Ok, bummer.

    Thanks for the quick response guys, much appreciated!

You must be logged in to reply to this topic.