Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix for implicit remote regression in restricted session#4222

Merged
daxian-dbw merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
PaulHigin:ImplicitRemoteBugCopy head branch name to clipboard
Jul 14, 2017
Merged

Fix for implicit remote regression in restricted session#4222
daxian-dbw merged 3 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
PaulHigin:ImplicitRemoteBugCopy head branch name to clipboard

Conversation

@PaulHigin

Copy link
Copy Markdown
Contributor

Issue #4195

PowerShell 5.1 Get-FormatData has a new required parameter (PowerShellVersion) which was not included in restricted sessions. So Import-PSSession fails when trying to use the parameter.

Fix is to add this parameter to the restricted session Get-FormatData proxy function.

Repro:

# Create and register a restricted session endpoint on local machine with PS 5.1
New-PSSessionConfigurationFile -Path c:\restricted.pssc -SessionType RestrictedRemoteServer
Register-PSSessionConfiguration -Path C:\restricted.pssc -Name restricted -Force
 
# Create and import a session instance
$s = New-PSSession -config restricted 
Import-PSSession -Session $s -AllowClobber
 
Result:
Import-PSSession : Running the Get-Command command in a remote session reported the following error: A parameter
cannot be found that matches parameter name 'PowerShellVersion'..
At line:1 char:1
+ Import-PSSession -Session $s -AllowClobber
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (:) [Import-PSSession], RuntimeException
    + FullyQualifiedErrorId : ErrorFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand

@PaulHigin PaulHigin added WG-Remoting PSRP issues with any transport layer Issue-Bug Issue has been identified as a bug in the product OS-Windows labels Jul 11, 2017
@PaulHigin PaulHigin added this to the 6.0.0-HighPriority milestone Jul 11, 2017
@PaulHigin PaulHigin requested a review from TravisEz13 July 11, 2017 18:44
@PaulHigin

Copy link
Copy Markdown
Contributor Author

There is no test associated with this fix because we have not ported implicit remoting tests yet.
I have created Issue #4223 to track this.

@daxian-dbw

daxian-dbw commented Jul 13, 2017

Copy link
Copy Markdown
Member

@PaulHigin we have implicit remoting tests at https://github.com/PowerShell/PowerShell/blob/master/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1
Can you please take a look to see if that's what you looked for?
If it is, could you please add the corresponding tests for this PR as well?

@PaulHigin

Copy link
Copy Markdown
Contributor Author

@daxian-dbw Thanks!, I didn't realize these tests were ported. I'll create a test for this fix.


if ($originalDefaultParameters -ne $null)
{
$PSDefaultParameterValues = $originalDefaultParameters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $global:PSDefaultParameterValues = $originalDefaultParameters. Otherwise, you are just defining a variable in the local scope.

@TravisEz13

Copy link
Copy Markdown
Member

restarted AppVeyor CI due to MyGet failure

@daxian-dbw daxian-dbw merged commit 7fa0dd0 into PowerShell:master Jul 14, 2017
@PaulHigin PaulHigin deleted the ImplicitRemoteBug branch July 14, 2017 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue-Bug Issue has been identified as a bug in the product OS-Windows WG-Remoting PSRP issues with any transport layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.