Title: JEA Not Working As Expected with RC1 · Issue #11538 · PowerShell/PowerShell · GitHub
Open Graph Title: JEA Not Working As Expected with RC1 · Issue #11538 · PowerShell/PowerShell
X Title: JEA Not Working As Expected with RC1 · Issue #11538 · PowerShell/PowerShell
Description: I am setting up JEA on a Server 2019 VM. The idea is to use JEA to enable a user to logon and do some DNS stuff. This process works with Server 2019 and WIndows PowerShell, but is not working with PowerShell 7 RC1. Steps to reproduce Her...
Open Graph Description: I am setting up JEA on a Server 2019 VM. The idea is to use JEA to enable a user to logon and do some DNS stuff. This process works with Server 2019 and WIndows PowerShell, but is not working with ...
X Description: I am setting up JEA on a Server 2019 VM. The idea is to use JEA to enable a user to logon and do some DNS stuff. This process works with Server 2019 and WIndows PowerShell, but is not working with ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11538
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JEA Not Working As Expected with RC1","articleBody":"I am setting up JEA on a Server 2019 VM. The idea is to use JEA to enable a user to logon and do some DNS stuff. This process works with Server 2019 and WIndows PowerShell, but is not working with PowerShell 7 RC1. \r\n\r\n# Steps to reproduce\r\n\r\nHere is how I have JEA setup so far:\r\n\r\n```powershell\r\n# 1. Create ReskitDNSAdmins security universal group in the OU\r\n$OURoot = 'OU=IT, DC=Reskit, DC=Org'\r\n$NGHT = @{\r\n Name = 'RKDnsAdmins'\r\n Path = $OURoot \r\n GroupScope = 'Universal'\r\n Description = 'RK DnsAdmins group for JEA'\r\n}\r\nNew-ADGroup @NGHT\r\n\r\n# 2. Add JerryG to the ReskitAdmin's Group\r\nAdd-ADGroupMember -Identity 'RKDNSADMINS' -Members 'JerryG'\r\n\r\n# 3. Create transcripts folder\r\nNew-Item -Path C:\\Foo\\JEATranscripts -ItemType Directory \r\n\r\n# 4. Build RC module folder\r\n$PF = $env:Programfiles\r\n$CP = 'WindowsPowerShell\\Modules\\RKDnsAdmins'\r\n$ModPath = Join-Path -Path $PF -ChildPath $CP\r\nNew-Item -Path $ModPath -ItemType Directory | Out-Null\r\n\r\n# 5. Create Role Capabilities file\r\n$RCHT = @{\r\n Path = 'C:\\Foo\\RKDnsAdmins.psrc' \r\n Author = 'Reskit Administration'\r\n CompanyName = 'Reskit.Org' \r\n Description = 'Defines RKDnsAdmins role capabilities'\r\n AliasDefinition = @{name='gh';value='Get-Help'}\r\n ModulesToImport = 'Microsoft.PowerShell.Core','DnsServer'\r\n VisibleCmdlets = (\"Restart-Service\",\r\n @{ Name = \"Restart-Computer\"; \r\n Parameters = @{Name = \"ComputerName\"}\r\n ValidateSet = 'DC1, DC2'},\r\n 'DNSSERVER\\*')\r\n VisibleExternalCommands = ('C:\\Windows\\System32\\whoami.exe')\r\n VisibleFunctions = 'Get-HW'\r\n FunctionDefinitions = @{\r\n Name = 'Get-HW'\r\n Scriptblock = {'Hello JEA World'}}\r\n}\r\nNew-PSRoleCapabilityFile @RCHT\r\n\r\n# 6. Create the Module Manifest in the Module Folder\r\n$P = Join-Path -Path $ModPath -ChildPath 'RKDnsAdmins.psd1'\r\nNew-ModuleManifest -Path $P -RootModule 'RKDNSAdmins.psm1'\r\n\r\n# 7. Create a Role Capabilities Folder and Copy The PSRC\r\n# File Into the Module\r\n$RCF = Join-Path -Path $ModPath -ChildPath 'RoleCapabilities'\r\nNew-Item -ItemType Directory $RCF\r\nCopy-Item -Path $RCHT.Path -Destination $RCF -Force\r\n\r\n# 8. Create a JEA Session Configuration file\r\n$P = 'C:\\Foo\\RKDnsAdmins.pssc'\r\n$RDHT = @{\r\n 'Reskit\\RKDnsAdmins' = @{RoleCapabilities = 'RKDnsAdmins'}\r\n}\r\n$PSCHT= @{\r\n Author = 'DoctorDNS@Gmail.Com'\r\n Description = 'Session Definition for RKDnsAdmins'\r\n SessionType = 'RestrictedRemoteServer' # ie JEA!\r\n Path = $P # the output file\r\n RunAsVirtualAccount = $true\r\n TranscriptDirectory = 'C:\\Foo\\JeaTranscripts'\r\n RoleDefinitions = $RDHT # RKDnsAdmins role mapping\r\n}\r\nNew-PSSessionConfigurationFile @PSCHT \r\n\r\n# 9. Test the session configuration file NB: This is successful\r\nTest-PSSessionConfigurationFile -Path C:\\Foo\\RKDnsAdmins.pssc \r\n\r\n# 10. Register the JEA Session Definition\r\n$SCHT = @{\r\n Path = 'C:\\Foo\\RKDnsAdmins.pssc'\r\n Name = 'RKDnsAdmins' \r\n Force = $true \r\n}\r\nRegister-PSSessionConfiguration @SCHT\r\n\r\n# 11. Check what the user can do: # NB THis produces the list as expected\r\nGet-PSSessionCapability -ConfigurationName RkDnsAdmins -Username 'Reskit\\Jerryg' |\r\n Sort-Object Module\r\n```\r\n\r\nHaving done that, I get odd results when trying to use it:\r\n\r\n```powershell\r\n# 12. Create Credentials for user JerryG\r\n$U = 'JerryG@Reskit.Org'\r\n$P = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force \r\n$Cred = New-Object System.Management.Automation.PSCredential $U,$P\r\n\r\n# 13. Define Three Script Blocks and an Invocation Splatting Hash Table\r\n$SB1 = {Get-Command}\r\n$SB2 = {Get-HW}\r\n$SB3 = {Get-Command -Name '*-DNSSERVER*'}\r\n$ICMHT = @{\r\n ComputerName = 'DC1.Reskit.Org'\r\n Credential = $Cred\r\n ConfigurationName = 'RKDnsAdmins'\r\n}\r\n\r\n# 14. How many Commands are available within the JEA session\r\nInvoke-Command -ScriptBlock $SB1 @ICMHT\r\n\r\nCommandType Name Version Source PSComputerName\r\n----------- ---- ------- ------ --------------\r\nFunction Clear-Host DC1.Reskit.Org\r\nFunction Exit-PSSession DC1.Reskit.Org\r\nFunction Get-Command DC1.Reskit.Org\r\nFunction Get-FormatData DC1.Reskit.Org\r\nFunction Get-Help DC1.Reskit.Org\r\nFunction Measure-Object DC1.Reskit.Org\r\nFunction Out-Default DC1.Reskit.Org\r\nFunction Select-Object DC1.Reskit.Org\r\n```\r\nThe set of commands available are not the same as shown after Step 11 above. Running Step 11, for example, shows the Get-HW.\r\n\r\nIf I try to run that command:\r\n```powershell\r\nPS C:\\Foo> Invoke-Command -ScriptBlock $SB2 @ICMHT\r\n\r\nObjectNotFound: The term 'Get-HW' is not recognized as the name of a cmdlet, function, script file, or operable program.\r\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\n```\r\nAlso, none of the DNS commands work in the JEA session either.\r\n\r\n# Expected behaviour\r\nI expected running $SB1 to show the same commands as offered from Step 11. \r\nI expected running $SB2 to return a string (as per the function definition in Step 5), \"Hello JEA World.\r\nI expected to be able to use the DNS commands. \r\n# Actual behaviour\r\n\r\n```none\r\n\r\n```\r\n\r\n# Environment data\r\n\r\n\r\n```none\r\nPS C:\\Foo> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-rc.1\r\nPSEdition Core\r\nGitCommitId 7.0.0-rc.1\r\nOS Microsoft Windows 10.0.17763 # Server 2019\r\nPlatform Win32NT\r\nPSCompatibleVersions {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-rc.1}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n\r\n```\r\n","author":{"url":"https://github.com/doctordns","@type":"Person","name":"doctordns"},"datePublished":"2020-01-09T17:46:38Z","url":"https://github.com/PowerShell/PowerShell/issues/11538"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2e51c551-097f-9731-f80d-0dbfdae71364 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED8C:3BBE40:C628B:119BC4:6AFD4B30 |
| html-safe-nonce | 4d1f087a11383a52fcc58adec11f689c2f80788816207421695f6f7a2fa0936b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDhDOjNCQkU0MDpDNjI4QjoxMTlCQzQ6NkFGRDRCMzAiLCJ2aXNpdG9yX2lkIjoiMzM4MDMwODE5MzQwMDY3MTAyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c183d360e8a699945db8eda0caed72a6d0286b05efac2014b2fec77be14c1b5d |
| hovercard-subject-tag | issue:547627302 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/11538/issue_layout |
| twitter:image | https://opengraph.githubassets.com/49acc4c2a0e494082b769f03468f4ccf0d9d626e0eae7d62db53240ae2e7f68f/PowerShell/PowerShell/issues/11538 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/49acc4c2a0e494082b769f03468f4ccf0d9d626e0eae7d62db53240ae2e7f68f/PowerShell/PowerShell/issues/11538 |
| og:image:alt | I am setting up JEA on a Server 2019 VM. The idea is to use JEA to enable a user to logon and do some DNS stuff. This process works with Server 2019 and WIndows PowerShell, but is not working with ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | doctordns |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width