FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix for implicit remote regression in restricted session by PaulHigin · Pull Request #4222 · PowerShell/PowerShell · GitHub

Fix for implicit remote regression in restricted session - #4222

Merged
Dongbo Wang (daxian-dbw) merged 3 commits into
PowerShell:masterfrom
PaulHigin:ImplicitRemoteBug
Jul 14, 2017
Merged

Fix for implicit remote regression in restricted session#4222
Dongbo Wang (daxian-dbw) merged 3 commits into
PowerShell:masterfrom
PaulHigin:ImplicitRemoteBug

Conversation

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

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.

Dongbo Wang (daxian-dbw) commented Jul 13, 2017
edited
Loading

Copy link
Copy Markdown
Member

Paul Higinbotham (@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?

Copy link
Copy Markdown
Contributor Author

Dongbo Wang (@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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

restarted AppVeyor CI due to MyGet failure

Dongbo Wang (daxian-dbw) merged commit 7fa0dd0 into PowerShell:master Jul 14, 2017
Paul Higinbotham (PaulHigin) deleted the ImplicitRemoteBug branch July 14, 2017 19:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL