January 1, 2012 at 12:00 am #6118
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
instance in RestrictedRemoteServer session.
by DonJ at 2013-03-24 06:19:05
Correct, and Full language is – as you note – a workaround. Albeit a clumsy one for what you're trying to do.
by shuvalov at 2013-03-24 06:44:24
[quote="DonJ"]Correct, and Full language is – as you note – a workaround. Albeit a clumsy one for what you're trying to do.[/quote]
Using CompleteInput with
::Create() isn`t 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:06
Just 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.
You must be logged in to reply to this topic.