Invoke-Command $using improvements by jborean93 · Pull Request #24025 · PowerShell/PowerShell

jborean93

@jborean93

@jborean93

daxian-dbw

@daxian-dbw daxian-dbw added CL-Engine

Indicates that a PR should be marked as an engine change in the Change Log

CL-General

Indicates that a PR should be marked as a general cmdlet change in the Change Log

and removed Review - Needed

The PR is being reviewed

CL-Engine

Indicates that a PR should be marked as an engine change in the Change Log

labels

Jul 29, 2025

@jborean93 @TravisEz13

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>

daxian-dbw

jborean93

@jborean93

daxian-dbw

Amro1984 pushed a commit to Amro1984/PowerShell that referenced this pull request

Aug 12, 2025
…ll#24025)

Always use the v5.1 `$using:` logic when dealing with any connection type that is not based on the `WSManConnectionInfo`. This allows the caller to use the more advanced `$using` features like variables with special names, having `$using` vars inside sub scopes, and more. `WSMan` based connections might still communicate with older versions but as the oldest supported version is v3 on Server 2012. We don't need to keep the default as v2 (which has been deprecated) to support some of the newer features.

Amro1984 pushed a commit to Amro1984/PowerShell that referenced this pull request

Aug 12, 2025
…ll#24025)

Always use the v5.1 `$using:` logic when dealing with any connection type that is not based on the `WSManConnectionInfo`. This allows the caller to use the more advanced `$using` features like variables with special names, having `$using` vars inside sub scopes, and more. `WSMan` based connections might still communicate with older versions but as the oldest supported version is v3 on Server 2012. We don't need to keep the default as v2 (which has been deprecated) to support some of the newer features.

SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request

Dec 12, 2025
…ll#24025)

Always use the v5.1 `$using:` logic when dealing with any connection type that is not based on the `WSManConnectionInfo`. This allows the caller to use the more advanced `$using` features like variables with special names, having `$using` vars inside sub scopes, and more. `WSMan` based connections might still communicate with older versions but as the oldest supported version is v3 on Server 2012. We don't need to keep the default as v2 (which has been deprecated) to support some of the newer features.