Enable tab completion using restricted PowerShell endpoint

Enable tab completion using restricted PowerShell endpoint

Q. How do I enable tab completion when using a restricted custom PowerShell endpoint?

A. When using a constrained endpoint in PowerShell you may find autocomplete does not work. This is because the tab complete is actually enabled via a function called Function:\TabExpansion2 which is not available. To fix simple may the function available in the constrained endpoint via the VisibleFunctions parameter, for example:

New-PSSessionConfigurationFile –ModulesToImport OneMOD, ActiveDirectory `
  -VisibleCmdLets ('*OneMOD*','*AD*') `
  -VisibleFunctions ('TabExpansion2') -VisibleAliases ('exit') –LanguageMode 'ConstrainedLanguage' `
  -SessionType 'RestrictedRemoteServer' –Path 'c:\onemodonly.pssc'

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish