Limitations of PowerShell JEA: No Automatic Credential Refresh in Persistent Sessions
0 reputation · 29 Mar 2022, 19:01 UTC
0 reputation · 29 Mar 2022, 19:01 UTC
PowerShell Just Enough Administration (JEA) enables least‑privilege remote sessions by constraining users to a predefined command set. A JEA session is typically created with a RunAsCredential that points to a service account. The session remains alive as long as the runspace is open.
When the service account’s password expires, or its Kerberos ticket lapses mid‑session, the remote runspace does not automatically re‑authenticate. Subsequent commands fail with authentication errors, and PowerShell provides no built‑in event or hook to detect the expiration while the session is active. PowerShell 7.x improves error reporting for authentication failures but still lacks a mechanism to refresh credentials or notify the session owner.
RunAsCredential changes.PSRemotingTransportException) are the only documented ways to detect expiration.A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.