Troubleshooting

PowerShell Just Enough Administration (JEA): Build Secure Delegated Admin Endpoints on Windows Server 2025

The Back Room Tech Staff · Edited by Aseem Kishore
20 min read

The Back Room Tech is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

An operator can query one Windows service while direct service commands stay blocked. PowerShell Just Enough Administration (JEA) uses a restricted endpoint, approved commands, and a separate execution identity to enforce that boundary.

This lab uses Windows Server 2025 and Windows PowerShell 5.1 to build BRT.JEA.ReadOnly.Lab. You’ll grant one standard account access to a fixed read-only task, protect transcripts, and test allowed and denied access. See also our guide on Automating Ubuntu Software Installation with Ansible: Playbooks for Server Provisioning.

Check the Windows Server 2025 JEA lab requirements

Use a controlled member-server lab with these prerequisites:

RequirementLab baseline
Endpoint hostWindows Server 2025 member server
Server consoleElevated, 64-bit Windows PowerShell 5.1
ClientSeparate Windows session running Windows PowerShell 5.1
AuthenticationExisting working authenticated PowerShell remoting in a lab domain
Setup accountServer administrator
Authorized operatorExisting standard domain account
Unauthorized operatorDifferent existing standard domain account outside the authorized group
StorageLocal space for configuration files and transcripts

Microsoft’s JEA prerequisites state that Windows Server 2016 and later include JEA. Windows Server 2025 doesn’t need a separate JEA download or Windows Management Framework install for this baseline.

Microsoft Learn links may show view=powershell-7.6. That selects a documentation version. It doesn’t tell you which runtime hosts your endpoint. This walkthrough creates the endpoint from Windows PowerShell 5.1.

Keep these three controls separate:

ControlWhat it determines
Endpoint permissionsWho can invoke the named endpoint
Role assignmentWhich commands an authorized user receives
Execution identityWhich Windows permissions those commands use

A narrow command list still needs narrow execution rights. Microsoft’s session configuration documentation explains the default. Virtual accounts join local Administrators on member servers. We’ll replace that default with a dedicated group that has no admin rights.

1. Confirm the server runtime and member-server role

Administrator console required: Run server setup and cleanup commands from an elevated local console. Registering and removing endpoints can interrupt WinRM connections.

Launch 64-bit Windows PowerShell as administrator. Its executable is:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

In that elevated console, run:

$PSVersionTable

Get-CimInstance -ClassName Win32_OperatingSystem |
    Select-Object Caption, Version

Get-CimInstance -ClassName Win32_ComputerSystem |
    Select-Object Name, PartOfDomain, DomainRole

Confirm:

  • PSEdition is Desktop.
  • PSVersion starts with 5.1.
  • The operating system is Windows Server 2025, with a Version value that starts with 10.0.26100. Use the build number rather than the Caption text, which can be localized.
  • PartOfDomain is True.
  • DomainRole is 3, which identifies a member server.

Stop if the host is a domain controller or the console reports Core.

Elevated Windows PowerShell 5.1 console showing Windows Server 2025 build 10.0.26100, PSEdition Desktop, and member-server DomainRole 3

2. Inspect the existing remoting baseline

On the server, run:

Get-Service -Name WinRM

Get-PSSessionConfiguration |
    Select-Object Name, PSVersion, Permission

WinRM should be running, and existing endpoint configurations should appear.

This walkthrough assumes authenticated remoting already works from the Windows client. If it doesn’t, fix that before you proceed. Enabling remoting changes shared host settings. This endpoint’s rollback won’t undo those changes.

Don’t change authentication settings, add TrustedHosts entries, or widen firewall access to make the lab connect.

3. Reserve the endpoint names before creating anything

Keep using the same elevated server console. Set the existing authorized account, replacing the example value:

$ErrorActionPreference = 'Stop'

$operatorAccount = 'CONTOSO\JEAReaderLab'

$endpointName = 'BRT.JEA.ReadOnly.Lab'
$readersName = 'BRT-JEA-Lab-Readers'
$runAsName = 'BRT-JEA-Lab-RunAs'

$moduleRoot = 'C:\Program Files\WindowsPowerShell\Modules\BRTJEAReadOnlyLab'
$labRoot = 'C:\ProgramData\BRT-JEA-ReadOnly-Lab'
$transcriptRoot = Join-Path $labRoot 'Transcripts'
$rolePath = Join-Path $moduleRoot 'RoleCapabilities\BRTReadOnlyLab.psrc'
$configPath = Join-Path $labRoot 'BRT.ReadOnly.Lab.pssc'

$collisions = @()

if (Get-PSSessionConfiguration -Name $endpointName -ErrorAction SilentlyContinue) {
    $collisions += $endpointName
}

foreach ($groupName in @($readersName, $runAsName)) {
    if (Get-LocalGroup -Name $groupName -ErrorAction SilentlyContinue) {
        $collisions += $groupName
    }
}

foreach ($path in @($moduleRoot, $labRoot)) {
    if (Test-Path -LiteralPath $path) {
        $collisions += $path
    }
}

if ($collisions.Count -gt 0) {
    throw "Stop: existing lab names found: $($collisions -join ', ')"
}

'Lab names are available.'

Expected result:

Lab names are available.

If a collision appears, stop. Don’t overwrite or remove an existing resource to fit this walkthrough.

This check helps you track which lab items are new. Record each item you create in case setup stops partway through.

Steps 4 through 9, the troubleshooting checks, and the cleanup section reuse these variables. If you close this console or open a new one, run the variable assignments from this block again before you continue.

Configure PowerShell Just Enough Administration (JEA) with a read-only role

A role capability file, ending in .psrc, defines approved commands and trusted functions. A session configuration file, ending in .pssc, defines the endpoint environment, role mappings, execution identity, and transcript path.

Microsoft’s JEA overview describes this delegation model. The task here is small: read three properties from the local W32Time service.

4. Create separate authorization and execution groups

Run on the server:

New-LocalGroup -Name $readersName `
    -Description 'Authorized users of the BRT read-only JEA lab'

New-LocalGroup -Name $runAsName `
    -Description 'Nonadministrative execution group for the BRT JEA lab'

Add-LocalGroupMember -Group $readersName -Member $operatorAccount

Get-LocalGroupMember -Group $readersName
Get-LocalGroupMember -Group $runAsName

The Readers group should contain the approved standard account. The RunAs group should return no direct members.

An empty member list only confirms direct membership. It doesn’t rule out the group being nested inside Administrators or another privileged local group, which would still grant administrative rights to anything placed in it.

Check for that nesting explicitly before you continue:

$privilegedGroups = @('Administrators', 'Backup Operators', 'Power Users', 'Remote Desktop Users')

$runAsNesting = foreach ($group in $privilegedGroups) {
    Get-LocalGroupMember -Group $group -ErrorAction SilentlyContinue |
        Where-Object { $_.Name -like "*\$runAsName" }
}

if ($runAsNesting) {
    throw "Stop: $runAsName is nested in a privileged local group: $($runAsNesting.Name -join ', ')"
}

'RunAs group has no privileged nesting found.'

Also open Local Security Policy (secpol.msc) and confirm the RunAs group holds no entries under Local Policies > User Rights Assignment. Stop the lab if the group is nested in a privileged group or holds any administrative local-policy right.

These checks cover the common local privilege paths, not every possible one. Domain Group Policy, other privileged local groups, and file or registry ACLs can still grant rights, so a brand-new, dedicated group is the main safeguard here.

Leave the RunAs group empty of direct members. JEA adds the temporary session identity to it through the endpoint configuration.

Don’t add either group to Administrators or another privileged group. Check that the operator account doesn’t already have admin access through another group.

5. Create protected module and configuration directories

The role function is trusted server-side code. Anyone who can edit it can change what the endpoint runs.

Create the two dedicated roots:

New-Item -ItemType Directory -Path $moduleRoot
New-Item -ItemType Directory -Path $labRoot

Apply a protected access control list to each root. This function grants full control only to SYSTEM and local Administrators:

function Set-BRTLabDirectoryAcl {
    param(
        [Parameter(Mandatory = $true)]
        [string]$Path
    )

    $acl = New-Object System.Security.AccessControl.DirectorySecurity

    # Disable inheritance and discard inherited entries on this new lab directory.
    $acl.SetAccessRuleProtection($true, $false)

    foreach ($sidText in @('S-1-5-18', 'S-1-5-32-544')) {
        $sid = [System.Security.Principal.SecurityIdentifier]::new($sidText)

        $rule = [System.Security.AccessControl.FileSystemAccessRule]::new(
            $sid,
            [System.Security.AccessControl.FileSystemRights]::FullControl,
            [System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit',
            [System.Security.AccessControl.PropagationFlags]::None,
            [System.Security.AccessControl.AccessControlType]::Allow
        )

        $acl.AddAccessRule($rule)
    }

    Set-Acl -LiteralPath $Path -AclObject $acl
}

Set-BRTLabDirectoryAcl -Path $moduleRoot
Set-BRTLabDirectoryAcl -Path $labRoot

The security identifiers work across localized group names. S-1-5-18 is SYSTEM. S-1-5-32-544 is local Administrators.

Create the child directories, then apply the same protected ACL to each one explicitly. That way their permissions don’t depend on inheritance from the parent:

New-Item -ItemType Directory -Path (Join-Path $moduleRoot 'RoleCapabilities')
New-Item -ItemType Directory -Path $transcriptRoot

Set-BRTLabDirectoryAcl -Path (Join-Path $moduleRoot 'RoleCapabilities')
Set-BRTLabDirectoryAcl -Path $transcriptRoot

New-ModuleManifest `
    -Path (Join-Path $moduleRoot 'BRTJEAReadOnlyLab.psd1') `
    -ModuleVersion '1.0.0' `
    -Author 'Lab administrator' `
    -Description 'Read-only JEA lab role'

(Get-Acl -LiteralPath $moduleRoot).Access |
    Format-Table IdentityReference, FileSystemRights, IsInherited

(Get-Acl -LiteralPath $transcriptRoot).Access |
    Format-Table IdentityReference, FileSystemRights, IsInherited

Expect only SYSTEM and Administrators entries on both directories. Operators and the RunAs group shouldn’t have access to these directories.

Microsoft states that SYSTEM writes JEA transcripts in its auditing documentation. The execution group doesn’t need access to the transcript directory.

Apply these permissions only to the new lab roots. Leave shared parent directories unchanged.

6. Define the fixed service-reading function

Create the role capability. The # File: comment in this block and in step 7 only shows where the command writes its output. Run each block in the elevated console as-is; don’t save the block itself to that path.

# File: C:\Program Files\WindowsPowerShell\Modules\BRTJEAReadOnlyLab\RoleCapabilities\BRTReadOnlyLab.psrc

$functionDefinition = @{
    Name = 'Get-BRTLabTimeService'
    ScriptBlock = {
        param()

        Microsoft.PowerShell.Management\Get-Service -Name 'W32Time' |
            Microsoft.PowerShell.Utility\Select-Object `
                -Property Name, Status, DisplayName
    }
}

New-PSRoleCapabilityFile `
    -Path $rolePath `
    -Author 'Lab administrator' `
    -Description 'Fixed local W32Time service query' `
    -VisibleFunctions 'Get-BRTLabTimeService' `
    -FunctionDefinitions $functionDefinition

Test-ModuleManifest `
    -Path (Join-Path $moduleRoot 'BRTJEAReadOnlyLab.psd1')

Get-Content -LiteralPath $rolePath

The manifest check should return module details for BRTJEAReadOnlyLab, version 1.0.0.

Review the role file. Its visible custom function should be Get-BRTLabTimeService, with the fixed W32Time query inside.

This wrapper accepts no task parameters. It avoids exposing Get-Service, so we don’t have to rely on restrictions around its optional parameters. Microsoft’s role capability documentation covers visible commands and trusted function definitions.

The module-qualified internal commands also make the intended code clear. They don’t give operators direct access to those commands.

7. Generate the restricted session configuration

Run:

# File: C:\ProgramData\BRT-JEA-ReadOnly-Lab\BRT.ReadOnly.Lab.pssc

$readersPrincipal = "$env:COMPUTERNAME\$readersName"
$roleCapabilityName = 'BRTReadOnlyLab'

$roleDefinitions = @{}
$roleDefinitions[$readersPrincipal] = @{
    RoleCapabilities = $roleCapabilityName
}

New-PSSessionConfigurationFile `
    -Path $configPath `
    -SessionType RestrictedRemoteServer `
    -RunAsVirtualAccount `
    -RunAsVirtualAccountGroups $runAsName `
    -TranscriptDirectory $transcriptRoot `
    -RoleDefinitions $roleDefinitions

Test-PSSessionConfigurationFile -Path $configPath

Expected result:

True

These settings define how the endpoint works:

SettingLab valuePractical effect
SessionTypeRestrictedRemoteServerRestricted session with NoLanguage mode and helper commands
RoleDefinitionsDedicated Readers groupAssigns the read-only role
RoleCapabilitiesBRTReadOnlyLabResolves the role file by name through the module’s RoleCapabilities folder
RunAsVirtualAccountEnabledCreates a temporary execution identity
RunAsVirtualAccountGroupsDedicated RunAs groupReplaces default administrative group assignment
TranscriptDirectoryProtected lab directoryRecords session activity

Referencing the role capability by name, instead of an absolute file path, matches the documented Windows PowerShell 5.1 syntax and lets JEA resolve the file through the module’s standard RoleCapabilities folder. Setting the virtual-account group keeps a read-only task from getting an admin execution token.

A True result from Test-PSSessionConfigurationFile confirms the configuration file passes syntax validation, as Microsoft’s session configuration documentation describes.

It doesn’t confirm that the endpoint task executes correctly, that permissions are set as intended, or that transcripts are written. Later steps in this lab test execution and access separately.

Role-capability resolution specifically is confirmed in step 9: Get-PSSessionCapability must list Get-BRTLabTimeService for the operator account before you move on to client testing. Stop and correct the role capability name or module path if that command doesn’t show it.

8. Register the endpoint with explicit connection permissions

Create an endpoint security descriptor using the dedicated Readers group’s security identifier:

$readerSid = (Get-LocalGroup -Name $readersName).SID.Value

# GA grants full endpoint control to SYSTEM and Administrators.
# GX grants connect-and-invoke access to the dedicated Readers group; the connection
# tests later in this lab are the authoritative confirmation of that behavior.
$endpointSddl = "O:NSG:BAD:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GX;;;$readerSid)"

Administrators retain endpoint control for setup and review. Only the dedicated Readers group gets delegated operator access.

Validate the descriptor before registering it. A string that fails to parse here will also fail at registration:

ConvertFrom-SddlString -Sddl $endpointSddl |
    Select-Object -ExpandProperty DiscretionaryAcl

Confirm the output lists SYSTEM and Administrators with full control and the Readers group’s SID with an allowed access right. If the command throws an error or the Readers entry is missing, fix the SDDL string before you register the endpoint.

This check only proves the string parses into the entries you expect. It doesn’t prove the endpoint will authorize connections that way; the connection tests in steps 10 and 12 do that.

WinRM interruption warning: Registration can restart WinRM and disconnect remote sessions. Run this from the controlled server console.

Register and inspect the endpoint:

Register-PSSessionConfiguration `
    -Name $endpointName `
    -Path $configPath `
    -SecurityDescriptorSddl $endpointSddl

Get-PSSessionConfiguration -Name $endpointName |
    Format-List Name, Permission, RoleDefinitions, TranscriptDirectory

Read and answer any confirmation prompts.

Expect the exact name BRT.JEA.ReadOnly.Lab and the dedicated Readers principal in permissions and roles. Check the protected transcript path too.

Treat this Permission output as a starting indicator, not final proof of the intended access level. The authorized and unauthorized connection tests later in this lab, in steps 10 and 12, are the actual confirmation that the Readers group can connect and that other accounts can’t.

Inspect the source configuration alongside the registered endpoint:

$configuration = Import-PowerShellDataFile -Path $configPath

$configuration |
    Select-Object SessionType, RunAsVirtualAccount,
        RunAsVirtualAccountGroups, TranscriptDirectory

$configuration.RoleDefinitions

Confirm RestrictedRemoteServer, virtual accounts enabled, and BRT-JEA-Lab-RunAs as the execution group.

Endpoint execution permission and role assignment need separate checks. Passing one doesn’t prove the other, as Microsoft’s session configuration guidance explains.

Registered BRT.JEA.ReadOnly.Lab endpoint showing Readers permission, role mapping, transcript path, and the dedicated RunAs group

9. Inspect the operator’s effective commands

On the server, run:

Get-PSSessionCapability `
    -ConfigurationName $endpointName `
    -Username $operatorAccount |
    Sort-Object Name |
    Format-Table Name, CommandType

Expect Get-BRTLabTimeService plus JEA’s default helper commands:

  • Clear-Host
  • Exit-PSSession
  • Get-Command
  • Get-FormatData
  • Get-Help
  • Measure-Object
  • Out-Default
  • Select-Object

This command is the server-side check that the RoleCapabilities mapping from step 7 resolved for that account name. If Get-BRTLabTimeService is missing, stop and correct the role capability name or module path before you test from the client.

It evaluates the role mapping and group membership as the server sees them now. A real session can still differ if the operator’s token predates a membership change, so the authenticated client test in step 10 remains the final confirmation.

Associated aliases can also appear. Microsoft lists these defaults in Using JEA.

Check any unexpected management commands before you continue. Multiple roles that apply to one user can widen their command set.

Verify allowed tasks and denied access from the Windows client

Use a separate Windows PowerShell 5.1 client console. The client doesn’t need elevation.

Keep client-side variables outside the remote script blocks. The remote endpoint’s NoLanguage restrictions apply inside those blocks.

10. Connect as the authorized standard account

Replace the server and account values:

$serverName = 'SERVER01.contoso.com'

$operatorCredential = Get-Credential `
    -UserName 'CONTOSO\JEAReaderLab' `
    -Message 'Enter the authorized standard lab account'

$session = New-PSSession `
    -ComputerName $serverName `
    -ConfigurationName 'BRT.JEA.ReadOnly.Lab' `
    -Authentication Kerberos `
    -Credential $operatorCredential `
    -ErrorAction Stop

$session |
    Format-Table ComputerName, ConfigurationName, State

The session should show Opened and the named JEA configuration. Enter the credentials at the prompt. Don’t save passwords in the script.

Now inspect the operator’s view:

Invoke-Command -Session $session -ScriptBlock {
    Get-Command
}

Invoke-Command -Session $session -ScriptBlock {
    Get-BRTLabTimeService
}

The command list should match the expected role and helpers. The fixed function should return one record with these fields:

PropertyExpected result
NameW32Time
StatusThe service’s actual current state
DisplayNameThe service’s installed display name

Don’t require Running as a passing result. Reading a stopped service is still a successful read-only query.

Nonadministrative identities can usually read a service’s status, but each service has its own security descriptor and local hardening can change it. If this call returns access denied instead of a record, go to step 17 rather than widening the RunAs group.

JEA operator command list including Get-BRTLabTimeService and its W32Time service result

11. Run harmless command-denial probes separately

Run each command separately so each rejection is visible:

Invoke-Command -Session $session -ScriptBlock {
    Get-Service -Name 'W32Time'
}

Expected result: Get-Service is unavailable, commonly reported as an unrecognized command.

Next:

Invoke-Command -Session $session -ScriptBlock {
    Get-Item -LiteralPath 'C:\Windows'
}

Expected result: Get-Item is also unavailable.

Finally:

Invoke-Command -Session $session -ScriptBlock {
    $labProbe = 1
}

Expected result: a rejection similar to “The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode.” Microsoft’s about_Language_Modes documentation states that JEA configurations use NoLanguage mode and that this mode doesn’t allow scripts or variables. If the assignment succeeds, stop and confirm that the registered endpoint uses RestrictedRemoteServer.

These probes don’t change services or files if an unintended command becomes available. If either direct command succeeds, stop and review the role before you continue.

Get-Service, Get-Item and a variable assignment each rejected inside the JEA session

12. Prove an unauthorized standard account can’t connect

Choose an existing standard account outside the Readers group and any other principals with endpoint access.

On the client:

$unauthorizedCredential = Get-Credential `
    -UserName 'CONTOSO\JEAUnauthorizedLab' `
    -Message 'Enter the unauthorized standard lab account'

$unexpectedSession = $null

try {
    $unexpectedSession = New-PSSession `
        -ComputerName $serverName `
        -ConfigurationName 'BRT.JEA.ReadOnly.Lab' `
        -Authentication Kerberos `
        -Credential $unauthorizedCredential `
        -ErrorAction Stop
}
catch {
    Write-Host $_.Exception.Message
}

if ($null -ne $unexpectedSession) {
    Remove-PSSession -Session $unexpectedSession
    throw 'FAIL: the unauthorized account connected. Review endpoint permissions.'
}

Expect an endpoint access rejection and no opened session.

A wrong password, name-resolution failure, or stopped WinRM service doesn’t prove the endpoint’s access rules work. Use valid credentials and the same working server route as the successful test.

Unauthorized account's connection to the BRT.JEA.ReadOnly.Lab endpoint rejected with Access is denied

Close the authorized session:

Remove-PSSession -Session $session

Inspect JEA transcripts and the limits of the restrictions

JEA’s command restrictions limit what an operator can request. Windows permissions still decide what trusted endpoint code can do.

“Read-only” in this lab describes the one task the role exposes, not a property JEA guarantees. The real boundary depends on the role file, every visible command, Readers and RunAs membership, the module directory permissions, and any other roles that apply to the same user.

NoLanguage blocks ordinary script syntax, but it doesn’t make an unsafe exposed command safe. Microsoft’s security considerations explain why commands, parameters, and execution rights each need review.

13. Read the completed transcript as an administrator

Return to the elevated server console after you close the client session:

$transcripts = @(
    Get-ChildItem -LiteralPath $transcriptRoot -Recurse -File |
        Sort-Object LastWriteTime -Descending
)

$transcripts |
    Select-Object FullName, Length, LastWriteTime

if ($transcripts.Count -eq 0) {
    throw 'No transcripts found. Review the transcript path and SYSTEM permissions.'
}

Get-Content -LiteralPath $transcripts[0].FullName

Inspect the transcript for:

  • The connecting operator account.
  • The temporary execution identity, usually identified under RunAs User.
  • Get-BRTLabTimeService and its returned output.
  • The harmless rejected attempts made during verification.

If several recordings exist, inspect the one matching your operator and session time. The newest file alone doesn’t prove identity.

Microsoft’s JEA audit guidance cautions that remoting can transform commands. Transcripts record effective activity, but they don’t always preserve the exact syntax typed on the client.

JEA transcript showing the connecting user, RunAs virtual account, and the Get-BRTLabTimeService result

14. Check existing event records without changing logging policy

Use the server console to inspect relevant records already available:

$since = (Get-Date).AddHours(-1)

Get-WinEvent -FilterHashtable @{
    LogName = 'Microsoft-Windows-WinRM/Operational'
    Id = 193
    StartTime = $since
} -ErrorAction SilentlyContinue |
    Select-Object TimeCreated, Id, Message

Get-WinEvent -FilterHashtable @{
    LogName = 'Microsoft-Windows-PowerShell/Operational'
    Id = 4104
    StartTime = $since
} -ErrorAction SilentlyContinue |
    Select-Object TimeCreated, Id, Message

WinRM event 193 can help link connecting and execution identities. PowerShell event 4104 is written only when script block logging is enabled. Neither query guarantees a matching record, and an empty result isn’t evidence that no activity occurred.

Setting TranscriptDirectory doesn’t enable script block logging. Leave logging policy unchanged for this narrowly scoped lab.

Local transcripts are also under administrator control. If you keep them on a backup NAS or another protected destination, apply its access and retention controls. A separate backup service adds recovery options, but neither choice makes the original transcript tamper-proof.

Virtual accounts also use the computer account for network access. Don’t assume the execution identity has no network reach because the wrapper reads a local service.

Fix common JEA lab failures without broadening privileges

Use this reference to choose the relevant check:

SymptomFirst check
Authorized connection rejectedEndpoint permissions, Readers membership, fresh authentication
Fixed function missingExact role path and effective role mapping
Fixed query returns access deniedRunAs group and local service read permissions
Transcript absentRegistered path and SYSTEM directory permissions

15. Diagnose an authorized operator’s connection rejection

On the server:

Get-PSSessionConfiguration -Name 'BRT.JEA.ReadOnly.Lab' |
    Format-List Name, Permission, RoleDefinitions

Get-LocalGroupMember -Group 'BRT-JEA-Lab-Readers'

Confirm the exact operator appears in Readers. Check that the endpoint permissions grant that group execution access.

If the endpoint descriptor differs from step 8, reapply the descriptor built there:

Set-PSSessionConfiguration `
    -Name 'BRT.JEA.ReadOnly.Lab' `
    -SecurityDescriptorSddl $endpointSddl

Run this from the server console because configuration updates can affect WinRM access.

Close the client session. If group membership is stale, sign out and back in, then create a fresh authenticated session. Don’t grant Remote Management Users or Administrators membership as a shortcut.

16. Diagnose a missing custom function

On the server:

Test-Path -LiteralPath $rolePath

Test-ModuleManifest `
    -Path (Join-Path $moduleRoot 'BRTJEAReadOnlyLab.psd1')

$configuration = Import-PowerShellDataFile -Path $configPath
$configuration.RoleDefinitions

Get-PSSessionCapability `
    -ConfigurationName $endpointName `
    -Username $operatorAccount

Expect the role path to exist, the manifest to validate, and Readers to map to the exact role capability name.

Fix a path or role error before you open another client session. Existing connections don’t reliably reflect configuration changes. Keep VisibleFunctions limited to the fixed task.

17. Diagnose access denied inside the allowed service query

On the server:

$configuration = Import-PowerShellDataFile -Path $configPath

$configuration.RunAsVirtualAccountGroups

Get-LocalGroupMember -Group 'BRT-JEA-Lab-RunAs'

Get-Service -Name 'W32Time' |
    Select-Object Name, Status, DisplayName

Confirm the configuration names only the dedicated RunAs group. Its permanent membership should still be empty, with no nesting in a privileged group as checked in step 4.

A successful admin query proves the service exists. It doesn’t prove the temporary identity has read access. If local service security blocks the query without admin rights, stop for a service-permission review.

Don’t add the RunAs group to Administrators. That would discard the execution boundary this lab is meant to show.

18. Diagnose missing or readable-by-operator transcripts

On the server:

Get-PSSessionConfiguration -Name $endpointName |
    Format-List TranscriptDirectory

(Get-Acl -LiteralPath $transcriptRoot).Access |
    Format-Table IdentityReference, FileSystemRights, IsInherited

Get-ChildItem -LiteralPath $transcriptRoot -Recurse -File

Confirm the registered path is correct and SYSTEM has inherited full control. Standard operators shouldn’t have access.

For new lab directories, review and reapply the directory protection from step 5 if it was changed. Close the test session, open a fresh one, run the fixed task, and inspect its completed recording.

Remove the exact JEA endpoint and newly created lab artifacts

19. Close lab sessions and decide whether to retain transcripts

Close any remaining lab sessions from each client console:

Get-PSSession |
    Where-Object {
        $_.ConfigurationName -eq 'BRT.JEA.ReadOnly.Lab'
    } |
    Remove-PSSession

Review the transcript list on the server:

Get-ChildItem `
    -LiteralPath 'C:\ProgramData\BRT-JEA-ReadOnly-Lab\Transcripts' `
    -Recurse -File |
    Select-Object FullName, Length, LastWriteTime

Save required recordings in an approved protected destination before you continue. Only remove items you’ve confirmed were created during this lab.

20. Unregister only the named endpoint

WinRM interruption warning: Unregistering can affect active remoting sessions. Use the local elevated server console.

Run:

Unregister-PSSessionConfiguration -Name 'BRT.JEA.ReadOnly.Lab'

$remainingEndpoint = Get-PSSessionConfiguration `
    -Name 'BRT.JEA.ReadOnly.Lab' `
    -ErrorAction SilentlyContinue

if ($remainingEndpoint) {
    throw 'The lab endpoint still exists. Stop before deleting its files.'
}

'BRT.JEA.ReadOnly.Lab is absent.'

Expected result:

BRT.JEA.ReadOnly.Lab is absent.

Unregistering removes this endpoint’s registration. It leaves the module files, local groups, transcript directory, and existing event records behind.

21. Delete only the new lab groups and directories

Deletion warning: These commands delete the dedicated lab files and remaining transcript copies. Proceed only after any required retention copy is complete.

Run:

Remove-LocalGroup -Name 'BRT-JEA-Lab-Readers'
Remove-LocalGroup -Name 'BRT-JEA-Lab-RunAs'

Remove-Item `
    -LiteralPath 'C:\Program Files\WindowsPowerShell\Modules\BRTJEAReadOnlyLab' `
    -Recurse

Remove-Item `
    -LiteralPath 'C:\ProgramData\BRT-JEA-ReadOnly-Lab' `
    -Recurse

Verify the result:

[pscustomobject]@{
    EndpointPresent = [bool](Get-PSSessionConfiguration `
        -Name 'BRT.JEA.ReadOnly.Lab' -ErrorAction SilentlyContinue)

    ReadersGroupPresent = [bool](Get-LocalGroup `
        -Name 'BRT-JEA-Lab-Readers' -ErrorAction SilentlyContinue)

    RunAsGroupPresent = [bool](Get-LocalGroup `
        -Name 'BRT-JEA-Lab-RunAs' -ErrorAction SilentlyContinue)

    ModuleDirectoryPresent = Test-Path -LiteralPath `
        'C:\Program Files\WindowsPowerShell\Modules\BRTJEAReadOnlyLab'

    LabDirectoryPresent = Test-Path -LiteralPath `
        'C:\ProgramData\BRT-JEA-ReadOnly-Lab'
} | Format-List

Expected result:

EndpointPresent        : False
ReadersGroupPresent    : False
RunAsGroupPresent      : False
ModuleDirectoryPresent : False
LabDirectoryPresent    : False
Cleanup verification returning False for the JEA endpoint, both lab groups, the module folder, and the lab folder

This rollback leaves shared remoting, firewall rules, and authentication settings unchanged. It also leaves unrelated endpoints, existing accounts, and Windows event records in place.

Wrapping Up

A useful JEA boundary pairs explicit connection permission with a narrow task and matching execution rights. I’d keep this fixed wrapper until another task has equally clear inputs and permissions.

StepActionApplies To
Establish the baselineConfirm Windows PowerShell 5.1 and existing remotingServer and client
Build the boundarySeparate authorization, role, and execution rightsServer
Prove behaviorTest the fixed task, harmless denials, and unauthorized accessClient
Review and removeInspect recordings, then delete exact lab artifactsServer

Put the next delegated task through the same allowed-action, denied-action, and unauthorized-account checks. A longer command list needs more review, even when every command sounds harmless.

Sources