by shuvalov at 2013-03-24 05:12:31
Hello. I was wondering for a way to implement tab expansion in RestrictedRemoteServer session type endpoints.
I know there are workarounds like Default session type and limiting everything in it or startup script like this http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/27/an-introduction-to-powershell-remoting-part-five-constrained-powershell-endpoints.aspx
I’m looking a way to find why running following code
[System.Management.Automation.CommandCompletion]::CompleteInput(‘get-comm’, 8, $null)
inside Default session return CompletionMatches data and running code in RestrictedRemoteServer return empty CompletionMatches.
Both session have LanguageMode = FullLanguage and if I create child powershell instance using
I can run completion for this instance using CompleteInput
[System.Management.Automation.CommandCompletion]::CompleteInput(‘get-comm’, 8, $null, $ps)
So its look like CommandCompletion can
t access current <code> instance in RestrictedRemoteServer session.</code></code></code></blockquote>by DonJ at 2013-03-24 06:19:05<blockquote>Correct, and Full language is - as you note - a workaround. Albeit a clumsy one for what you're trying to do.</blockquote>by shuvalov at 2013-03-24 06:44:24<blockquote>[quote="DonJ"]Correct, and Full language is - as you note - a workaround. Albeit a clumsy one for what you're trying to do.[/quote]<br>Using CompleteInput with <code>::Create() isnt workaround in real as it will expand command available in child runspace, not those available in current endpoint runspace. So it will expand all default commands even those not available for user and not expand any custom commands loaded in endpoint.
Furthermore after some testing I found that if I call modified TabExpansion2 function with
::create() in it will return CompletionMatches but powershell host will ignore it.
by shuvalov at 2013-05-06 02:47:06Just to let everyone know.
I got confirmation from MS support that this is by design and not yet documented due to documentation bug. So TabCompletion not going to work in any RestrictedRemoteServer endpoint.
For related functionality (http://technet.microsoft.com/en-us/library/hh831417.aspx
) there is an explicit acknowledgement of this.