# LibTmux\Remove-TmuxSession

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.PowerShell/RemoveTmuxSessionCommand.cs#L7
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-remove-tmuxsession/

```
Remove-TmuxSession
    [-Session] <LibTmux.Session>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
```

Remove an explicit native session without emitting an object.

Remove the supplied native [`LibTmux.Session`](/en/csharp/latest/reference/libtmux-session/). The endpoint and daemon generation
come from that handle. Windows linked into another session survive; windows
owned only by the removed session and their panes are destroyed. Removing the
last session can stop the daemon when its configuration requires that.

This high-impact operation requests confirmation by default. [`WhatIf`](/en/powershell/latest/reference/libtmux-remove-tmuxsession/#LibTmux%5CRemove-TmuxSession.parameter.WhatIf) performs
no acquisition or mutation. Cancellation does not restore removed resources.

### Notes

Failures use [`Tmux.SessionRemoveFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Remove-TmuxSession.md#notes) and retain the original core exception,
its dispatch information and the failed owner. [`ErrorAction`](/en/powershell/latest/reference/libtmux-remove-tmuxsession/#LibTmux%5CRemove-TmuxSession.parameter.ErrorAction) Continue permits
later owners to be processed; [`ErrorAction`](/en/powershell/latest/reference/libtmux-remove-tmuxsession/#LibTmux%5CRemove-TmuxSession.parameter.ErrorAction) Stop stops on the first failure.
A missing target remains an error. No mutation is retried. Previously captured
handles retain their old data after removal and are not refreshed in place.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Confirmation:** Supports `-WhatIf` and `-Confirm`; confirm impact: High.
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Session`: A native LibTmux.Session selected from an explicit endpoint.
- **Outputs:** `System.Void`

Related APIs:

- [Remove sessions, windows and panes](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/remove.md)
- [Choose endpoints and owners](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/read.md)

## Examples

Example 1

Remove the previously selected native $session from an endpoint you own.
This example explicitly suppresses confirmation; omitting Confirm uses the
normal high-impact confirmation behavior.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/Remove-TmuxSession.md).

```powershell
$session | LibTmux\Remove-TmuxSession -Confirm:$false
```

## Parameters

- `Session` (`LibTmux.Session`): The native session to remove. Select it explicitly using Get-TmuxSession
on the endpoint you intend to change.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.
- `WhatIf` (`System.Management.Automation.SwitchParameter`): Runs the command in a mode that only reports what would happen without performing the actions.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `wi`.
- `Confirm` (`System.Management.Automation.SwitchParameter`): Prompts you for confirmation before running the cmdlet.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `cf`.

## Returns

`None`: No success objects are emitted. An empty input pipeline performs no work.
