Join our Newsletter — 33% off our NHI Course
Home› Guides› Windows Remote Management and WinRM/PowerShell Remoting Security Guide:…
Guide Endpoint Security

Windows Remote Management and WinRM/PowerShell Remoting Security Guide: HTTPS Listeners, JEA Endpoints and Detection

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 13 min read
On this page

WinRM and PowerShell Remoting are how Windows estates are administered at scale, and the same channel is one of the most common lateral movement routes once an attacker holds an admin credential. By default, remoting gives members of the local Administrators group a full PowerShell session on every server, which means every automation account and every helpdesk technician with admin rights has unrestricted remote shell access. This guide covers how WinRM authenticates and encrypts, how to configure listeners and authentication safely, how Just Enough Administration (JEA) replaces broad admin rights with constrained endpoints, how service accounts and automation should connect, and which logs show misuse. It assumes you have read the PowerShell Security Guide, which covers script block logging, Constrained Language Mode and AMSI; this page goes deeper on the remoting layer.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • Remoting is admin by default. Only members of Administrators can connect out of the box, so every admin credential is also a remote shell credential (ATT&CK T1021.006 Windows Remote Management).
  • HTTP on 5985 is encrypted, but not always authenticated both ways. Kerberos gives mutual authentication and message encryption; NTLM verifies the user but not the server, and Basic sends credentials in clear text. Keep Basic and AllowUnencrypted off and use HTTPS on 5986 where Kerberos is not available.
  • JEA turns admin access into named tasks. A JEA endpoint runs a RestrictedRemoteServer session in NoLanguage mode, exposes only listed commands, and runs them as a temporary virtual account, so the connecting user needs no admin rights.
  • Avoid CredSSP and fixed RunAs credentials. Microsoft warns CredSSP caches credentials on the remote server; fixed RunAsCredential endpoints are not JEA-aware and lose user attribution.
  • Log both sides of the identity. Event 4104 with module or script block logging records the ConnectedUser and RunAsUser, and WinRM Operational event 193 records both SIDs for each JEA session.

How identity and access work in WinRM

WinRM is Microsoft's implementation of WS-Management. The WinRM service runs as Network Service, accepts connections on its listeners, and starts an isolated host process (wsmprovhost.exe) running as the authenticated user for each PowerShell session, so one user's session cannot reach another's process. Normal Windows access control then applies to everything the session does.

ElementDefaultSecurity meaning
HTTP listenerTCP 5985Traffic encrypted at message level after authentication with Kerberos or NTLM
HTTPS listenerTCP 5986 (not created by default)TLS; needs a Server Authentication certificate whose CN or SAN matches the host name
Who can connectAdministrators groupEvery local admin, including service and automation accounts, has a remote shell
Firewall rulePrivate profile: any source; Public profile: same subnet onlyDo not widen the public rule; restrict sources to management subnets
KerberosOn; used when connecting by computer name in a domainMutual authentication, no reusable credential sent; AES-256 on modern systems
NegotiateOnKerberos for domain accounts, NTLM for local accounts or IP addresses
NTLM to IP addresses or workgroup hostsBlocked unless HTTPS is used or the host is in the client's TrustedHostsUser verified, server not verified; message encryption uses RC4
Basic (service)OffCredentials in clear text; never enable on HTTP
CredSSP (client and service)OffDelegates the user's full credentials to the target
AllowUnencrypted (client and service)FalseMust stay false

TrustedHosts is not a trust list. Microsoft describes it as the list of hosts for which you suppress the error raised when the server's identity cannot be verified; computers in it are not authenticated, so credentials may be sent to an impostor. Keep it empty and use Kerberos or HTTPS instead. See the NTLM Deprecation and Elimination Guide.

Admin roles and privileged access

The default model gives a binary choice: no remote access, or full admin. JEA replaces it with endpoints that expose specific tasks. A DNS operator can restart the DNS service and clear the cache on a domain controller without being in Domain Admins.

How a JEA endpoint is built

  • Role capability file (.psrc): created with New-PSRoleCapabilityFile and stored in a RoleCapabilities folder inside a PowerShell module. It lists VisibleCmdlets, VisibleFunctions and VisibleExternalCommands, optionally with allowed parameter values.
  • Session configuration file (.pssc): created with New-PSSessionConfigurationFile. It sets SessionType = 'RestrictedRemoteServer', maps groups to roles in RoleDefinitions, chooses the run-as identity and sets TranscriptDirectory. Validate with Test-PSSessionConfigurationFile.
  • Registration: Register-PSSessionConfiguration -Name <endpoint> -Path <file>. To change mappings, unregister and re-register.
  • Two separate gates: the endpoint ACL (who may connect, at least Invoke rights, seen in Get-PSSessionConfiguration Permission) and RoleDefinitions (what they may run). Check both.

A RestrictedRemoteServer session runs in NoLanguage mode with only eight default commands (Clear-Host, Exit-PSSession, Get-Command, Get-FormatData, Get-Help, Measure-Object, Out-Default, Select-Object) and no providers or external programs until a role adds them.

Choosing the run-as identity

OptionHow it worksUse whenWatch out for
Virtual account (RunAsVirtualAccount)Temporary local account per session, destroyed at the end; user never knows its credentialsDefault choice for local administration tasksMember of Administrators (or Domain Admins on a DC) unless you set RunAsVirtualAccountGroups, which removes the default admin membership
Group managed service account (GroupManagedServiceAccount)Session runs as a gMSA with a network identityTask must reach file shares or web services on other hostsAll users share one identity, so attribution relies on transcripts and event 193; scope the gMSA tightly. See the Group Managed Service Accounts (gMSA) Guide
No run-as (pass-through)User's own tokenNot recommendedUser needs privileged group membership and can bypass JEA
Fixed RunAsCredentialStored credential shared by all usersNever on JEA endpointsNot JEA-aware, everyone gets the same role, credential must be maintained

Role design rules from Microsoft's security guidance

  • No wildcards: *-Process includes Start-Process, which can launch any program with admin rights. List each cmdlet.
  • No FileSystem or Certificate provider: file write access bypasses controls; the Certificate provider can expose private keys. Use MountUserDrive (default 50 MB per user) for file transfer.
  • No runspace creation: exclude *-Job cmdlets and Windows Compatibility, plus Update-TypeData, Remove-TypeData, Update-FormatData and Trace-Command. Exclude Invoke-Expression and anything that runs arbitrary script.
  • Do not reimplement the default proxies for the eight default commands; custom versions reopen gaps.
  • Require extra conditions: RequiredGroups adds And/Or group conditions, for example membership of a just-in-time group and a smart card or MFA logon group.
  • JEA does not constrain admins: anyone who is already a local administrator can use RDP, remote MMC or the default endpoint, or edit the JEA configuration. JEA only reduces risk once the standing admin rights are removed. Pair it with the Privileged Access Management Guide approach to just-in-time elevation.

Integrations, API tokens and service accounts

Configuration management tools, monitoring agents, backup software, deployment pipelines and orchestration platforms connect over WinRM using service accounts. These are high-value non-human identities: one account often has admin rights on hundreds of servers.

  • Give automation its own JEA endpoint: a deployment account that only runs a signed deployment function should connect to an endpoint exposing that function, not to Microsoft.PowerShell with full admin.
  • Prefer gMSAs for the calling account: where the automation runs on Windows, a gMSA removes the static password. See the Windows Services and Service Account Security Guide.
  • Use Kerberos, by name: connect by fully qualified host name so Kerberos is used; tools that connect by IP fall back to NTLM and push you towards TrustedHosts.
  • Linux and cross-platform clients: tools that connect from Linux often default to NTLM or Basic. Configure Kerberos or certificate authentication over HTTPS, and never enable Basic on the service to make a tool work.
  • Do not store credentials in scripts: plain-text passwords in -Credential objects built from strings, in scheduled task arguments or in pipeline variables are the usual leak. Use the platform's secret store or a vault. See the Secrets Management Guide.
  • Second hop: when a remote command must reach a third server, Microsoft ranks the options. CredSSP caches credentials on the intermediate server and should be enabled only in the most trusted environments; unconstrained Kerberos delegation is less secure than CredSSP and for testing only; resource-based Kerberos constrained delegation stores nothing but is not the documented second-hop route for WinRM itself, so confirm with Microsoft; JEA with a virtual account or gMSA avoids passwords but needs configuration on each intermediate server. See the Kerberos Delegation Security Guide.

Logging and detection

SourceEventWhat it tells you
Microsoft-Windows-PowerShell/Operational4104 (script block logging)Commands run, including in remote sessions; for JEA, includes ConnectedUser and RunAsUser
Microsoft-Windows-Windows Remote Management/Operational193New JEA session with SID and name of connecting user and RunAs user, for correlating virtual account activity to a person
JEA transcript directoryTranscript filesStart time, Username, RunAs User and each CommandInvocation and ParameterBinding; written by Local System, so lock the folder against standard users
Security log4624 logon type 3 followed by wsmprovhost.exe process creation (4688 or EDR telemetry)Inbound remoting session; unusual source hosts or accounts indicate lateral movement
WinRM configurationwinrm get winrm/config, Get-PSSessionConfigurationDrift: Basic or AllowUnencrypted enabled, new endpoints, widened endpoint ACLs, TrustedHosts set to *

Alert on remoting sessions from workstations that are not admin workstations, on service accounts connecting from hosts other than their automation server, on Register-PSSessionConfiguration or Set-PSSessionConfiguration outside change windows, and on CredSSP being enabled. ATT&CK techniques to map detections to: T1021.006 Windows Remote Management, T1059.001 PowerShell and T1078.002 Domain Accounts. See the Active Directory Security Monitoring and Event IDs Guide and the Lateral Movement Guide.

Metrics

  • Standing remote admins: number of accounts with unrestricted remoting rights per server tier, trending down as JEA rolls out.
  • JEA coverage: percentage of recurring operational tasks delivered through JEA endpoints.
  • Legacy authentication settings: servers with Basic, AllowUnencrypted, CredSSP or a non-empty TrustedHosts (target zero without exception).
  • Attribution: percentage of JEA and remoting sessions where event 193 or 4104 ties a virtual account or gMSA action to a named user.
  • Source restriction: percentage of servers where the WinRM firewall rule allows only management subnets.

Hardening baseline

  1. Restrict network reach first: scope the WinRM firewall rules to management subnets and privileged access workstations. See the Privileged Access Workstations Guide.
  2. Enforce authentication settings by Group Policy: under Computer Configuration, Administrative Templates, Windows Components, Windows Remote Management, keep Basic authentication and unencrypted traffic disallowed on both client and service, keep CredSSP disabled, and set channel binding hardening (CbtHardeningLevel, default Relaxed) to Strict where clients support it. Use the Microsoft Security Baselines Guide values as the starting point.
  3. Add HTTPS where Kerberos is unavailable: install a CA-issued certificate with the Server Authentication EKU and matching CN or SAN, run winrm quickconfig -transport:https, then confirm the thumbprint with winrm enumerate winrm/config/listener. Do not use self-signed certificates.
  4. Build JEA endpoints for the top tasks: start with the most frequent helpdesk and operations tasks. Run in a pilot ring with transcripts on and use Get-PSSessionCapability -ConfigurationName <endpoint> -Username <user> to confirm effective rights.
  5. Remove standing admin membership: once a role's tasks work through JEA, remove its members from local Administrators. Keep a break-glass path documented.
  6. Restrict the default endpoint: limit who may connect to Microsoft.PowerShell with Set-PSSessionConfiguration -SecurityDescriptorSddl to a small admin group, so day-to-day users can only reach JEA endpoints.
  7. Turn on logging before go-live: script block or module logging, the WinRM Operational log and transcript collection into your SIEM.
  8. Roll back safely: JEA endpoints are additive; rollback is restoring the removed group membership or unregistering the endpoint with Unregister-PSSessionConfiguration. Keep .psrc and .pssc files in source control and deploy them with configuration management or DSC so every server has the same version.

Small and large estates

  • Small: keep Kerberos over HTTP inside the domain, restrict the firewall, build two or three JEA endpoints for helpdesk tasks, and remove helpdesk staff from Administrators.
  • Large: publish role capabilities as a versioned internal module, assign endpoints per server tier, integrate RequiredGroups with just-in-time groups, and alert on any session to the default endpoint by non-tier-0 staff.

Common misconfigurations

  • TrustedHosts set to *: done to make NTLM by IP work, it disables server authentication for every target and lets credentials go to any host that answers.
  • Basic or AllowUnencrypted enabled for a third-party tool: credentials and session content cross the network in clear text.
  • CredSSP left on after troubleshooting: credentials are cached on the remote host, available to anyone who compromises it (T1003.001 LSASS Memory).
  • JEA roles with wildcards or Start-Process: a "restricted" endpoint that is an admin shell in practice.
  • Virtual accounts left in Administrators: forgetting RunAsVirtualAccountGroups means every role runs as full local admin, or Domain Admins on a domain controller.
  • JEA deployed but admin rights not removed: users keep RDP and the default endpoint, so JEA adds logging but no restriction.
  • Automation accounts with domain-wide admin: one account with remoting rights on every server, a password in a script and no source restriction is a complete lateral movement path.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev. 5AC-17 Remote Access; AC-6 Least Privilege; SC-8 Transmission Confidentiality and Integrity; AU-2 and AU-12Remoting restrictions, JEA roles, encryption and HTTPS, session logging
NIST CSF 2.0PR.AA-05; PR.DS-02; PR.PS-04; DE.CM-03Least privilege, data in transit, log generation, monitoring of administrator activity
CIS Controls v8.1Control 4 Secure Configuration; Control 5 Account Management; Control 6 Access Control Management; Control 8 Audit Log ManagementWinRM baseline, service account control, endpoint ACLs, logging
ISO/IEC 27001:2022 Annex AA.8.2 Privileged access rights; A.8.15 Logging; A.8.20 Networks securityDelegated administration, session records, management network restriction
MITRE ATT&CKT1021.006; T1059.001; T1078.002; T1003.001; T1550.002Remoting abuse, PowerShell execution, use of stolen admin credentials

Practitioner checklist

  • Scope WinRM firewall rules on every server to management subnets and admin workstations.
  • Enforce by Group Policy: Basic off, AllowUnencrypted off, CredSSP off, TrustedHosts empty.
  • Use Kerberos by host name inside the domain and CA-issued HTTPS listeners on 5986 elsewhere.
  • Build JEA endpoints with explicit cmdlet lists, no wildcards, no FileSystem provider and virtual accounts limited by RunAsVirtualAccountGroups.
  • Remove standing local admin rights once JEA covers a role's tasks, and restrict the default Microsoft.PowerShell endpoint.
  • Give each automation tool its own gMSA or vaulted credential and its own endpoint, limited to its source host.
  • Enable script block logging, collect WinRM Operational event 193 and JEA transcripts, and alert on new or changed session configurations.
  • Audit effective rights quarterly with Get-PSSessionConfiguration and Get-PSSessionCapability.

Standards and references

Related NHI Mgmt Group resources: PowerShell Security Guide · Group Managed Service Accounts (gMSA) Guide · Lateral Movement Guide · Privileged Access Management Guide · Local Administrator Password Solution (LAPS) Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.