Skip to content

Register-PSSessionConfiguration fails if SesionConfig folder doesn't exist - #4271

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:implicit-remoting-test
Jul 18, 2017
Merged

Register-PSSessionConfiguration fails if SesionConfig folder doesn't exist#4271
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:implicit-remoting-test

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Create SessionConfig folder if it doesn't exist for Register-PSSessionConfiguration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Paul Higinbotham (@PaulHigin) Windows PowerShell 5.1 needs this change as well before this test will pass, right (since the default remoting endpoint still goes to Windows PowerShell)? If so, I'll change this test to Pending

@PaulHigin

Copy link
Copy Markdown
Contributor

Steve Lee (@SteveL-MSFT) I thought that we use a new plugin for PowerShell 6.0. Not sure but I know a new plugin was created for Core. James Truher (@JamesWTruher) can you comment?

Regarding PowerShell 5.1, the SessionConfig folder should always be created via Windows manifest. I feel this change is only needed for the case where the folder is inadvertently deleted (through some previous test) or for PowerShell 6.0 when it is never created.

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Sync'd with Paul Higinbotham (@PaulHigin) off line, this test will still fail because the default endpoint still points to 5.1 which doesn't have the fix to expose -PowerShellVersion yet. Rather than making this test pending, I think it makes sense to have the default remoting to go to 6.0, I'll look into that.

@daxian-dbw

Copy link
Copy Markdown
Member

Rather than making this test pending, I think it makes sense to have the default remoting to go to 6.0, I'll look into that.

Paul Higinbotham (@PaulHigin) Steve Lee (@SteveL-MSFT) Will that be a separate PR? If so, I will merge this one.

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) I'm going to make it part of this PR otherwise the test will still fail

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

I'm going to make this test Pending as it's blocked by #4275

@daxian-dbw

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) one question before merging the PR: the test in question has been there for a long time, so why did it start to fail recently?

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Dongbo Wang (@daxian-dbw) that specific test was added recently by Paul Higinbotham (@PaulHigin) SteveL-MSFT@7fa0dd0

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 44e3775 into PowerShell:master Jul 18, 2017
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the implicit-remoting-test branch July 18, 2017 17:09
@PaulHigin

Copy link
Copy Markdown
Contributor

It looks like similar implicit remoting tests in Implicit.Remoting.Tests.ps1 are disabled for core and we should do the same for this test. Is there an Issue for this?

string destFolder = System.IO.Path.Combine(Utils.DefaultPowerShellAppBase, "SessionConfig");
if (!Directory.Exists(destFolder))
{
Directory.CreateDirectory(destFolder);

@iSazonov Ilya (iSazonov) Jul 18, 2017

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for being late - what if the user haven't permissions?

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.

Good catch! For example, on Linux, powershell is installed at /opt/microsoft/powershell, and you don't have permission to create a folder unless using sudo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ilya (@iSazonov) Thanks, we will have to think about how this will work and where configuration information goes for Linux cases, but for now I think letting an "access denied" error propagate is fine since these cmdlets cannot work correctly without access.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I should mention that these cmdlets are currently implemented only on Windows platform.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you please open a tracking Issue?

# Blocked by https://github.com/PowerShell/PowerShell/issues/4275
# Need a way to created restricted endpoint based on a different endpoint other than microsoft.powershell which points
# to Windows PowerShell 5.1
It "Verifies that Import-PSSession works on a restricted session" -Pending {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just noticed that similar implicit remoting tests are disabled using special checks:

# Skip tests for CoreCLR for now
# Skip tests on ARM
$skipTest = $IsCoreCLR -or $env:PROCESSOR_ARCHITECTURE -eq 'ARM'

if ($skipTest) { return }

We should make this test be the same since remoting really does not work yet with PowerShell 6.0 based endpoints. Or maybe we should mark all tests that aren't supported as "pending" since we no longer support FullCLR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Paul Higinbotham (@PaulHigin) can you open a separate issue for this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done. Issue #4289

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants