GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix for implicit remote regression in restricted session by PaulHigin · Pull Request #4222 · PowerShell/PowerShell

Conversation

@PaulHigin

@PaulHigin Paul Higinbotham (PaulHigin) commented Jul 11, 2017

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@PaulHigin
Fix for implicit remote regression in restricted session
5976952
@PaulHigin Paul Higinbotham (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 Paul Higinbotham (PaulHigin) added this to the 6.0.0-HighPriority milestone Jul 11, 2017
@PaulHigin Paul Higinbotham (PaulHigin) assigned Mike Richmond (mirichmo) Jul 11, 2017
@PaulHigin
Paul Higinbotham (PaulHigin) requested a review from Travis Plunk (TravisEz13) July 11, 2017 18:44
@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-not-required label Jul 11, 2017
@PaulHigin

Paul Higinbotham (PaulHigin) commented Jul 11, 2017

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13
Travis Plunk (TravisEz13) approved these changes Jul 11, 2017
View reviewed changes
@daxian-dbw

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

Uh oh!

There was an error while loading. Please reload this page.

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulHigin

Paul Higinbotham (PaulHigin) commented Jul 14, 2017

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulHigin
Added test to existing implicit remoting tests
1b93a94
TravisEz13
Travis Plunk (TravisEz13) approved these changes Jul 14, 2017
View reviewed changes
daxian-dbw
Dongbo Wang (daxian-dbw) reviewed Jul 14, 2017
View reviewed changes
Comment thread test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 Outdated

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

@daxian-dbw Dongbo Wang (daxian-dbw) Jul 14, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@PaulHigin
Fixed default param scope
8fe36cf
@TravisEz13

Travis Plunk (TravisEz13) commented Jul 14, 2017

Copy link
Copy Markdown
Member

restarted AppVeyor CI due to MyGet failure

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daxian-dbw
Dongbo Wang (daxian-dbw) approved these changes Jul 14, 2017
View reviewed changes
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 7fa0dd0 into PowerShell:master Jul 14, 2017
@PaulHigin
Paul Higinbotham (PaulHigin) deleted the ImplicitRemoteBug branch July 14, 2017 19:30
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@PaulHigin @daxian-dbw
Fix for implicit remote regression in restricted session (PowerShell#…
ab657fa
…4222)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@daxian-dbw Dongbo Wang (daxian-dbw) daxian-dbw approved these changes
@TravisEz13 Travis Plunk (TravisEz13) TravisEz13 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@mirichmo Mike Richmond (mirichmo)

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

Milestone

6.0.0-GA

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@PaulHigin @daxian-dbw @TravisEz13 @msftclas @mirichmo
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.