Repository navigation
Description
Windows Version
Microsoft Windows [Version 10.0.26200.8973]
WSL Version
2.9.4.0
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
6.18.35.2-1
Distro Version
No response
Other Software
No response
Repro Steps
- Create a defaultly-named session by running a container with WSLC under your own account. E.g.:
C:\Windows\System32>wslc run --rm hello-world Hello from Docker! [...] - Create a second defaultly-named session by running a container under your own account, but elevated
- Run
wslc system session list(and see in Task Manager). You now have two session VMs:wslc-cli-Userandwslc-cli-admin-User.
Due to being lightweight Hyper-V VMs, your only way of terminating them is withwslc system session terminate. - Run
wslc system session terminate --help - Notice the command help specifies it can accept a session name in the description, but the command format does not mention it:
Copyright (c) Microsoft Corporation. All rights reserved. For privacy information about this product please visit https://aka.ms/privacy. Terminates an active session. If no session is specified, the default session will be terminated. Usage: wslc system session terminate [<options>] The following options are available: -?,--help Shows help about the selected command
- Attempt to specify a session name (or ID) anyway. Notice it complains about a positional argument that was not expected:
C:\Windows\System32>wslc system session list ID Creator PID Display Name 1 1234 wslc-cli-User 2 5678 wslc-cli-admin-User C:\Windows\System32>wslc system session terminate 2 Copyright (c) Microsoft Corporation. All rights reserved. For privacy information about this product please visit https://aka.ms/privacy. Found a positional argument when none was expected: '2' [...help text follows...] C:\Windows\System32>wslc system session terminate wslc-cli-User Copyright (c) Microsoft Corporation. All rights reserved. For privacy information about this product please visit https://aka.ms/privacy. Found a positional argument when none was expected: 'wslc-cli-User' [...help text follows...]
- Running an unspecified terminate command works, but of course only terminates the session owned by the current user and integrity level:
C:\Windows\System32>wslc system session terminate C:\Windows\System32>wslc system session list ID Creator PID Display Name 1 1234 wslc-cli-User
- Running
[...]terminatea second time fails as the session does not exist anymore:C:\Windows\System32>wslc system session terminate Session not found: 'wslc-cli-admin-User' Error code: WSLC_E_SESSION_NOT_FOUND
The end result is: If you started several sessions across user accounts and integrity levels, those sessions can only be terminated by the users (and integrity levels) who started them.
Expected Behavior
wslc system session terminate should accept a session name (or ID if the ordering of wslc system session list is consistent across calls and can be trusted), and allow a user at or above trust level to terminate another session. I.e.: a non-elevated user account would be able to terminate their own non-elevated session, while an elevated user account would be able to terminate all other users' elevated and non-elevated sessions.
If not, the command description should be amended.
However, in that case, due to Hyper-V lightweight VMs being unmanageable with regular tools, a user can end up with essentially "leaked" VMs if they don't know about the sessions' user + integrity distinction.
Actual Behavior
wslc system session terminate does not accept any other option than --help/-?, and can only terminate the default session.
See repro steps for full console output of this & related commands.
Diagnostic Logs
No response
Activity
github-actions commentedon Aug 1, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to wsl-gh-logs@microsoft.com with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
[-]"wslc system session terminate" claims to accept a session name, but only supports terminating the default session[/-][+]`wslc system session terminate` claims to accept a session name, but only supports terminating the default session[/+]github-actions commentedon Aug 1, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to wsl-gh-logs@microsoft.com with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
idann commentedon Aug 1, 2026
/feature
This is effectively a feature request as it details a feature that seems to be described but not implemented.
github-actions commentedon Aug 1, 2026
Diagnostic information
dkbennett commentedon Sep 11, 2026
The session specifier is a global argument, which is placed after the root: wslc --session foo system session terminate
This functionality works and is tested, but the global specifier can be a little confusing. I have a PR which improves this such that adding --session anywhere in the command line will generate a prescriptive error on where to place it instead of an unknown/invalid argument error.