Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JEA - Errors when attempting to Start-Service in a JEA session #14650

Closed
doctordns opened this issue Jan 22, 2021 · 7 comments
Closed

JEA - Errors when attempting to Start-Service in a JEA session #14650

doctordns opened this issue Jan 22, 2021 · 7 comments
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-No Activity Issue has had no activity for 6 months or more WG-Remoting PSRP issues with any transport layer

Comments

@doctordns
Copy link
Contributor

doctordns commented Jan 22, 2021

I have a JEA session setup. I attach the session configuration and role capabilities files.

Here are the files
JEA issue.zip

This configuration (attempts to) enable Start-Service and Stop Service cmdlets to allow starting/stopping the DNS Service.

I see two specific issues:

  1. If I run a script block to {Start-Service -Name DNS}, I get an error that the Name parameter is unknown. If I attempt to pipe the service name (eg {'DNS" | Start-Service} I get no error, but the service does not start. I checked this on other services as well.
  2. Using Get-PSSessionCapability also does not correctly show the Start-Service or Stop-Service cmdlets as cmdlets. They are shown as functions. This makes sense for the DNS Server cmdlets as they are loaded via WPS Compat, but the cmdlets are, well cmdlets not functions.

Steps to reproduce

  1. Define JEA endpoints per the attached
  2. Run Get-PSSessionCapability

Expected behavior

  1. Enabling start-service to start the DNS service
  2. Showing Start-Service as a cmdlet not a function

Actual behavior

  1. For first issue:
PS C:\Foo> $sb4 = {Start-Service -Name DNS -Verbose}
Invoke-Command -ScriptBlock $SB4 @ICMHT
Start-Service: A parameter cannot be found that matches parameter name 'Name'.
  1. For second issue:
PS C:\Foo> # 11. Viewing remoting endpoints
Get-PSSessionConfiguration  |
  Format-Table -Property NAME, PSVersion, Run*Account

Name             PSVersion RunAsVirtualAccount
----             --------- -------------------
DnsAdminsJEA     7.1       True
PowerShell.7     7.1       false
PowerShell.7.1.1 7.1       false

PS C:\Foo> # 12. Verifying what the user can do
$SCHT = @{
  ConfigurationName = 'DnsAdminsJEA'
  Username          = 'Reskit\JerryG'
}
Get-PSSessionCapability  @SCHT |
  Sort-Object -Property Module

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           clear -> Clear-Host
Function        Stop-Service
Function        Start-Service
Function        Select-Object
Function        Restart-Computer
Function        Out-Default
Function        Measure-Object
Function        Get-HW
Function        Get-Help
Application     ipconfig.exe                                       10.0.2028… C:\WINDOWS\system32\ipconfig.exe
Function        Get-Command
Function        Exit-PSSession
Function        Clear-Host
Function        Get-FormatData
Application     whoami.exe                                         10.0.2028… C:\WINDOWS\system32\whoami.exe
Alias           gh -> Get-Help
Alias           gcm -> Get-Command
Alias           select -> Select-Object
Alias           cls -> Clear-Host
Alias           exsn -> Exit-PSSession
Alias           measure -> Measure-Object
Function        Set-DnsServerClientSubnet                          2.0.0.0    DnsServer

Environment data

Name Value


PSVersion 7.1.1
PSEdition Core
GitCommitId 7.1.1
OS Microsoft Windows 10.0.20285
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0, 7.1.1}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0


@doctordns doctordns added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Jan 22, 2021
@doctordns
Copy link
Contributor Author

Purely, as an aside, how much testing is done with JEA? Are there tests performed prior to shipping a new version? If so, pointers please? If not, I am unclear how to add them, but the attached files are a good starting point (IMHO!).

@iSazonov iSazonov added WG-Engine core PowerShell engine, interpreter, and runtime Needs-Triage The issue is new and needs to be triaged by a work group. labels Jan 28, 2021
@daxian-dbw daxian-dbw added WG-Remoting PSRP issues with any transport layer and removed WG-Engine core PowerShell engine, interpreter, and runtime labels Jan 28, 2021
@doctordns doctordns changed the title JEA - Errors when attempting to Start-Service i a JEA session JEA - Errors when attempting to Start-Service in a JEA session Jan 29, 2021
@TravisEz13
Copy link
Member

TravisEz13 commented Mar 17, 2021

remoting working group: This needs more investigation. https://github.com/PowerShell/PowerShell/files/5855630/JEA.issue.zip

@K0nne
Copy link

K0nne commented Mar 24, 2021

Hello,

we are also trying to use powershell functions in a JEA session via VisibleFunctions and get similar errors:

Select-Object: A parameter cannot be found that matches parameter name 'ExpandProperty'.

Before "select-object" was added to the VisibleFunctions section of the role capability file.
Since then we also got the following warning message:

WARNING: The 'Microsoft.PowerShell.Utility' module was not imported because the 'Microsoft.PowerShell.Utility' snap-in was already imported.

The warning led me to the following JEA issue.
It was pointed out that this might be an powershell issue. Also a possible solution was given:
PowerShell/JEA#42 (comment)

I hope this is related.

Our system (server 2016):

Name                           Value
----                           -----
PSVersion                      5.1.14393.3866
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.3866
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Edit: Get-FileHash ist also affected.
Here's an article about the problem: https://jnury.github.io/JEA_term_not_recognized_name_cmdlet/

@PaulHigin PaulHigin added Issue-Bug Issue has been identified as a bug in the product and removed Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Needs-Triage The issue is new and needs to be triaged by a work group. labels Jun 8, 2021
@PaulHigin PaulHigin added this to the Future milestone Jun 8, 2021
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

2 similar comments
Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

Copy link
Contributor

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-No Activity Issue has had no activity for 6 months or more labels Nov 16, 2023
Copy link
Contributor

This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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 Resolution-No Activity Issue has had no activity for 6 months or more WG-Remoting PSRP issues with any transport layer
Projects
None yet
Development

No branches or pull requests

6 participants