From 887585a690eaf023be9067afb645b745850bd58f Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 14 Jun 2024 09:15:28 -0500 Subject: [PATCH 1/3] Add note about the interactive nature of Enter-PSSession (#11189) --- .../Enter-PSSession.md | 42 +++++----- .../Enter-PSSession.md | 77 +++++++++--------- .../Enter-PSSession.md | 80 ++++++++++--------- .../Enter-PSSession.md | 80 ++++++++++--------- 4 files changed, 144 insertions(+), 135 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md index 42b1c7ade15..fa29dc557b1 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enter-pssession?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Enter-PSSession @@ -89,6 +89,10 @@ interactive session. However, you cannot use the `Disconnect-PSSession`, `Connec To end the interactive session and disconnect from the remote computer, use the `Exit-PSSession` cmdlet, or type `exit`. +> [!IMPORTANT] +> `Enter-PSSession` is designed to substitute a new remote session for the current interactive +> session. You shouldn't call it from within script context. + ## EXAMPLES ### Example 1: Start an interactive session @@ -316,17 +320,17 @@ Accept wildcard characters: False ### -ConfigurationName -Specifies the session configuration that is used for the interactive session. +Specifies the session configuration that's used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: `http://schemas.microsoft.com/powershell`. The session configuration for a session is located on the remote computer. If the specified session -configuration does not exist on the remote computer, the command fails. +configuration doesn't exist on the remote computer, the command fails. The default value is the value of the `$PSSessionConfigurationName` preference variable on the local -computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more +computer. If this preference variable isn't set, the default is Microsoft.PowerShell. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). ```yaml @@ -352,11 +356,11 @@ The default value is as follows: `http://localhost:5985/WSMAN` -If you do not specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, +If you don't specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, and **ApplicationName** parameters to specify the **ConnectionURI** values. Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection -URI with a Transport segment, but do not specify a port, the session is created by using standards +URI with a Transport segment, but don't specify a port, the session is created by using standards ports: 80 for HTTP and 443 for HTTPS. To use the default ports for PowerShell remoting, specify port 5985 for HTTP or 5986 for HTTPS. @@ -520,7 +524,7 @@ Accept wildcard characters: False ### -Port -Specifies the network port on the remote computer that is used for this command. To connect to a +Specifies the network port on the remote computer that's used for this command. To connect to a remote computer, the remote computer must be listening on the port that the connection uses. The default ports are 5985, which is the WinRM port for HTTP, and 5986, which is the WinRM port for HTTPS. @@ -531,7 +535,7 @@ listen at that port. Use the following commands to configure the listener: 1. `winrm delete winrm/config/listener?Address=*+Transport=HTTP` 2. `winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="\"}` -Do not use the **Port** parameter unless you must. The port setting in the command applies to all +Don't use the **Port** parameter unless you must. The port setting in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers. @@ -565,9 +569,9 @@ Accept wildcard characters: False ### -Session -Specifies a Windows PowerShell session (**PSSession**) to use for the interactive session. This -parameter takes a session object. You can also use the **Name**, **InstanceID**, or **ID** -parameters to specify a **PSSession**. +Specifies a PowerShell session (**PSSession**) to use for the interactive session. This parameter +takes a session object. You can also use the **Name**, **InstanceID**, or **ID** parameters to +specify a **PSSession**. Enter a variable that contains a session object or a command that creates or gets a session object, such as a `New-PSSession` or `Get-PSSession` command. You can also pipe a session object to @@ -596,11 +600,11 @@ by using the `New-PSSessionOption` cmdlet, or a hash table in which the keys are names and the values are session option values. The default values for the options are determined by the value of the `$PSSessionOption` preference -variable, if it is set. Otherwise, the default values are established by options set in the session +variable, if it's set. Otherwise, the default values are established by options set in the session configuration. The session option values take precedence over default values for sessions set in the -`$PSSessionOption` preference variable and in the session configuration. However, they do not take +`$PSSessionOption` preference variable and in the session configuration. However, they don't take precedence over maximum values, quotas or limits set in the session configuration. For a description of the session options, including the default values, see `New-PSSessionOption`. @@ -623,13 +627,13 @@ Accept wildcard characters: False ### -UseSSL Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to establish a connection to -the remote computer. By default, SSL is not used. +the remote computer. By default, SSL isn't used. -WS-Management encrypts all Windows PowerShell content transmitted over the network. The **UseSSL** -parameter is an additional protection that sends the data across an HTTPS connection instead of an -HTTP connection. +WS-Management encrypts all PowerShell content transmitted over the network. The **UseSSL** parameter +is an additional protection that sends the data across an HTTPS connection instead of an HTTP +connection. -If you use this parameter, but SSL is not available on the port that is used for the command, the +If you use this parameter, but SSL isn't available on the port that's used for the command, the command fails. ```yaml @@ -717,7 +721,7 @@ to change the command prompt, run before the remote prompt is displayed. find the local UI culture, use the `$UICulture` automatic variable. `Enter-PSSession` requires the `Get-Command`, `Out-Default`, and `Exit-PSSession` cmdlets. If these -cmdlets are not included in the session configuration on the remote computer, the `Enter-PSSession` +cmdlets aren't included in the session configuration on the remote computer, the `Enter-PSSession` commands fails. Unlike `Invoke-Command`, which parses and interprets the commands before it sends them to the remote diff --git a/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md index f6f3e44107b..ef339b8518c 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enter-pssession?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Enter-PSSession @@ -85,13 +85,13 @@ Enter-PSSession [-ContainerId] [-ConfigurationName ] [-RunAsAdm ## DESCRIPTION -The `Enter-PSSession` cmdlet starts an interactive session with a single remote computer. -During the session, the commands that you type run on the remote computer, just as if you were -typing directly on the remote computer. You can have only one interactive session at a time. +The `Enter-PSSession` cmdlet starts an interactive session with a single remote computer. During the +session, the commands that you type run on the remote computer, just as if you were typing directly +on the remote computer. You can have only one interactive session at a time. Typically, you use the **ComputerName** parameter to specify the name of the remote computer. However, you can also use a session that you create by using the `New-PSSession` cmdlet for the -interactive session. However, you cannot use the `Disconnect-PSSession`, `Connect-PSSession`, or +interactive session. However, you can't use the `Disconnect-PSSession`, `Connect-PSSession`, or `Receive-PSSession` cmdlets to disconnect from or re-connect to an interactive session. Starting with PowerShell 6.0 you can use Secure Shell (SSH) to establish a connection to a remote @@ -105,6 +105,10 @@ information about how to set up PowerShell SSH remoting, see To end the interactive session and disconnect from the remote computer, use the `Exit-PSSession` cmdlet, or type `exit`. +> [!IMPORTANT] +> `Enter-PSSession` is designed to substitute a new remote session for the current interactive +> session. You shouldn't call it from within script context. + ## EXAMPLES ### Example 1: Start an interactive session @@ -130,7 +134,7 @@ The command is submitted to the remote computer, and the file is saved on the re The third command uses the **Exit** keyword to end the interactive session and close the connection. The fourth command confirms that the Process.txt file is on the remote computer. A `Get-ChildItem` -("dir") command on the local computer cannot find the file. +("dir") command on the local computer can't find the file. ```powershell PS C:\> Enter-PSSession -ComputerName Server01 @@ -207,10 +211,10 @@ specifies the location of an RSA key used to authenticate the user on the remote ### -AllowRedirection Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). By default, -redirection is not allowed. +redirection isn't allowed. When you use the **ConnectionURI** parameter, the remote destination can return an instruction to -redirect to a different URI. By default, PowerShell does not redirect connections, but you can use +redirect to a different URI. By default, PowerShell doesn't redirect connections, but you can use this parameter to allow it to redirect the connection. You can also limit the number of times the connection is redirected by changing the @@ -233,10 +237,10 @@ Accept wildcard characters: False ### -ApplicationName Specifies the application name segment of the connection URI. Use this parameter to specify the -application name when you are not using the **ConnectionURI** parameter in the command. +application name when you aren't using the **ConnectionURI** parameter in the command. The default value is the value of the `$PSSessionApplicationName` preference variable on the local -computer. If this preference variable is not defined, the default value is WSMAN. This value is +computer. If this preference variable isn't defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). @@ -258,7 +262,7 @@ Accept wildcard characters: False ### -Authentication -Specifies the mechanism that is used to authenticate the user's credentials. The acceptable values +Specifies the mechanism that's used to authenticate the user's credentials. The acceptable values for this parameter are: - Default @@ -303,7 +307,7 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts; they don't work with domain accounts. To get a certificate, use the `Get-Item` or `Get-ChildItem` command in the PowerShell Cert: drive. @@ -352,7 +356,7 @@ Accept wildcard characters: False ### -ConfigurationName -Specifies the session configuration that is used for the interactive session. +Specifies the session configuration that's used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: @@ -362,10 +366,10 @@ When used with SSH, this specifies the subsystem to use on the target as defined default value for SSH is the `powershell` subsystem. The session configuration for a session is located on the remote computer. If the specified session -configuration does not exist on the remote computer, the command fails. +configuration doesn't exist on the remote computer, the command fails. The default value is the value of the `$PSSessionConfigurationName` preference variable on the local -computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more +computer. If this preference variable isn't set, the default is Microsoft.PowerShell. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). ```yaml @@ -410,11 +414,11 @@ The default value is as follows: `http://localhost:5985/WSMAN` -If you do not specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, +If you don't specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, and **ApplicationName** parameters to specify the **ConnectionURI** values. Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection -URI with a Transport segment, but do not specify a port, the session is created by using standards +URI with a Transport segment, but don't specify a port, the session is created by using standards ports: 80 for HTTP and 443 for HTTPS. To use the default ports for PowerShell remoting, specify port 5985 for HTTP or 5986 for HTTPS. @@ -625,7 +629,7 @@ Accept wildcard characters: False ### -Port -Specifies the network port on the remote computer that is used for this command. +Specifies the network port on the remote computer that's used for this command. In PowerShell 6.0 this parameter was included in the **HostName** parameter set which supports Secure Shell (SSH) connections. @@ -642,7 +646,7 @@ listen at that port. Use the following commands to configure the listener: 1. `winrm delete winrm/config/listener?Address=*+Transport=HTTP` 2. `winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="\"}` -Do not use the **Port** parameter unless you must. The port setting in the command applies to all +Don't use the **Port** parameter unless you must. The port setting in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers. @@ -712,11 +716,11 @@ by using the `New-PSSessionOption` cmdlet, or a hash table in which the keys are names and the values are session option values. The default values for the options are determined by the value of the `$PSSessionOption` preference -variable, if it is set. Otherwise, the default values are established by options set in the session +variable, if it's set. Otherwise, the default values are established by options set in the session configuration. The session option values take precedence over default values for sessions set in the -`$PSSessionOption` preference variable and in the session configuration. However, they do not take +`$PSSessionOption` preference variable and in the session configuration. However, they don't take precedence over maximum values, quotas or limits set in the session configuration. For a description of the session options, including the default values, see `New-PSSessionOption`. @@ -763,10 +767,10 @@ Accept wildcard characters: False Specifies the SSH subsystem used for the new **PSSession**. This specifies the subsystem to use on the target as defined in sshd_config. The subsystem starts a -specific version of PowerShell with predefined parameters. If the specified subsystem does not exist +specific version of PowerShell with predefined parameters. If the specified subsystem doesn't exist on the remote computer, the command fails. -If this parameter is not used, the default is the 'powershell' subsystem. +If this parameter isn't used, the default is the `powershell` subsystem. ```yaml Type: System.String @@ -783,19 +787,16 @@ Accept wildcard characters: False ### -UserName Specifies the user name for the account used to create a session on the remote computer. User -authentication method will depend on how Secure Shell (SSH) is configured on the remote computer. +authentication method depends on how Secure Shell (SSH) is configured on the remote computer. -If SSH is configured for basic password authentication then you will be prompted for the user -password. +If SSH is configured for basic password authentication then you are prompted for the user password. -If SSH is configured for key based user authentication then a key file path can be provided via the -**KeyFilePath** parameter and no password prompt will occur. Note that if the client user key file -is located in an SSH known location then the **KeyFilePath** parameter is not needed for key based -authentication, and user authentication will occur automatically based on the user name. See SSH -documentation about key based user authentication for more information. +If SSH is configured for key based user authentication then uou aren't prompted for a password. You +must provide a path to an SSH key file. If the user key file is located in an SSH known location +then the **KeyFilePath** parameter isn't needed. User authentication occurs automatically based on +the user name. See SSH documentation about key based user authentication for more information. -This is not a required parameter. If no **UserName** parameter is specified then the current log on -user name is used for the connection. +If the **UserName** parameter isn't specified then the current logged on username is used. This parameter was introduced in PowerShell 6.0. @@ -814,13 +815,13 @@ Accept wildcard characters: False ### -UseSSL Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to establish a connection to -the remote computer. By default, SSL is not used. +the remote computer. By default, SSL isn't used. WS-Management encrypts all PowerShell content transmitted over the network. The **UseSSL** parameter is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. -If you use this parameter, but SSL is not available on the port that is used for the command, the +If you use this parameter, but SSL isn't available on the port that's used for the command, the command fails. ```yaml @@ -909,7 +910,7 @@ to change the command prompt, run before the remote prompt is displayed. find the local UI culture, use the `$UICulture` automatic variable. `Enter-PSSession` requires the `Get-Command`, `Out-Default`, and `Exit-PSSession` cmdlets. If these -cmdlets are not included in the session configuration on the remote computer, the `Enter-PSSession` +cmdlets aren't included in the session configuration on the remote computer, the `Enter-PSSession` commands fails. Unlike `Invoke-Command`, which parses and interprets the commands before it sends them to the remote @@ -924,13 +925,13 @@ The **HostName** parameter set was included starting with PowerShell 6.0. It was PowerShell remoting based on Secure Shell (SSH). Both SSH and PowerShell are supported on multiple platforms (Windows, Linux, macOS) and PowerShell remoting works over these platforms where PowerShell and SSH are installed and configured. This is separate from the previous Windows only -remoting that is based on WinRM and much of the WinRM specific features and limitations do not +remoting that's based on WinRM and much of the WinRM specific features and limitations don't apply. For example, WinRM based quotas, session options, custom endpoint configuration, and disconnect/reconnect features are currently not supported. For more information about how to set up PowerShell SSH remoting, see [PowerShell Remoting Over SSH](/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core). -Prior to PowerShell 7.1, remoting over SSH did not support second-hop remote sessions. This +Prior to PowerShell 7.1, remoting over SSH didn't support second-hop remote sessions. This capability was limited to sessions using WinRM. PowerShell 7.1 allows `Enter-PSSession` and `Enter-PSHostProcess` to work from within any interactive remote session. diff --git a/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md index 9dd3545f004..208ab3f2617 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enter-pssession?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Enter-PSSession @@ -66,7 +66,8 @@ Enter-PSSession [-Name ] [] ### VMId ``` -Enter-PSSession [-VMId] [-Credential] [-ConfigurationName ] [] +Enter-PSSession [-VMId] [-Credential] [-ConfigurationName ] + [] ``` ### VMName @@ -85,13 +86,13 @@ Enter-PSSession [-ContainerId] [-ConfigurationName ] [-RunAsAdm ## DESCRIPTION -The `Enter-PSSession` cmdlet starts an interactive session with a single remote computer. -During the session, the commands that you type run on the remote computer, just as if you were -typing directly on the remote computer. You can have only one interactive session at a time. +The `Enter-PSSession` cmdlet starts an interactive session with a single remote computer. During the +session, the commands that you type run on the remote computer, just as if you were typing directly +on the remote computer. You can have only one interactive session at a time. Typically, you use the **ComputerName** parameter to specify the name of the remote computer. However, you can also use a session that you create by using the `New-PSSession` cmdlet for the -interactive session. However, you cannot use the `Disconnect-PSSession`, `Connect-PSSession`, or +interactive session. However, you can't use the `Disconnect-PSSession`, `Connect-PSSession`, or `Receive-PSSession` cmdlets to disconnect from or re-connect to an interactive session. Starting with PowerShell 6.0 you can use Secure Shell (SSH) to establish a connection to a remote @@ -105,6 +106,10 @@ information about how to set up PowerShell SSH remoting, see To end the interactive session and disconnect from the remote computer, use the `Exit-PSSession` cmdlet, or type `exit`. +> [!IMPORTANT] +> `Enter-PSSession` is designed to substitute a new remote session for the current interactive +> session. You shouldn't call it from within script context. + ## EXAMPLES ### Example 1: Start an interactive session @@ -130,7 +135,7 @@ The command is submitted to the remote computer, and the file is saved on the re The third command uses the **Exit** keyword to end the interactive session and close the connection. The fourth command confirms that the Process.txt file is on the remote computer. A `Get-ChildItem` -("dir") command on the local computer cannot find the file. +("dir") command on the local computer can't find the file. ```powershell PS C:\> Enter-PSSession -ComputerName Server01 @@ -222,10 +227,10 @@ connection to the remote system. ### -AllowRedirection Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). By default, -redirection is not allowed. +redirection isn't allowed. When you use the **ConnectionURI** parameter, the remote destination can return an instruction to -redirect to a different URI. By default, PowerShell does not redirect connections, but you can use +redirect to a different URI. By default, PowerShell doesn't redirect connections, but you can use this parameter to allow it to redirect the connection. You can also limit the number of times the connection is redirected by changing the @@ -248,10 +253,10 @@ Accept wildcard characters: False ### -ApplicationName Specifies the application name segment of the connection URI. Use this parameter to specify the -application name when you are not using the **ConnectionURI** parameter in the command. +application name when you aren't using the **ConnectionURI** parameter in the command. The default value is the value of the `$PSSessionApplicationName` preference variable on the local -computer. If this preference variable is not defined, the default value is WSMAN. This value is +computer. If this preference variable isn't defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). @@ -273,7 +278,7 @@ Accept wildcard characters: False ### -Authentication -Specifies the mechanism that is used to authenticate the user's credentials. The acceptable values +Specifies the mechanism that's used to authenticate the user's credentials. The acceptable values for this parameter are: - Default @@ -318,7 +323,7 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts; they don't work with domain accounts. To get a certificate, use the `Get-Item` or `Get-ChildItem` command in the PowerShell Cert: drive. @@ -367,7 +372,7 @@ Accept wildcard characters: False ### -ConfigurationName -Specifies the session configuration that is used for the interactive session. +Specifies the session configuration that's used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: @@ -377,10 +382,10 @@ When used with SSH, this specifies the subsystem to use on the target as defined default value for SSH is the `powershell` subsystem. The session configuration for a session is located on the remote computer. If the specified session -configuration does not exist on the remote computer, the command fails. +configuration doesn't exist on the remote computer, the command fails. The default value is the value of the `$PSSessionConfigurationName` preference variable on the local -computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more +computer. If this preference variable isn't set, the default is Microsoft.PowerShell. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). ```yaml @@ -425,11 +430,11 @@ The default value is as follows: `http://localhost:5985/WSMAN` -If you do not specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, +If you don't specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, and **ApplicationName** parameters to specify the **ConnectionURI** values. Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection -URI with a Transport segment, but do not specify a port, the session is created by using standards +URI with a Transport segment, but don't specify a port, the session is created by using standards ports: 80 for HTTP and 443 for HTTPS. To use the default ports for PowerShell remoting, specify port 5985 for HTTP or 5986 for HTTPS. @@ -662,7 +667,7 @@ Accept wildcard characters: False ### -Port -Specifies the network port on the remote computer that is used for this command. +Specifies the network port on the remote computer that's used for this command. In PowerShell 6.0 this parameter was included in the **HostName** parameter set which supports Secure Shell (SSH) connections. @@ -679,7 +684,7 @@ listen at that port. Use the following commands to configure the listener: 1. `winrm delete winrm/config/listener?Address=*+Transport=HTTP` 2. `winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="\"}` -Do not use the **Port** parameter unless you must. The port setting in the command applies to all +Don't use the **Port** parameter unless you must. The port setting in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers. @@ -749,11 +754,11 @@ by using the `New-PSSessionOption` cmdlet, or a hash table in which the keys are names and the values are session option values. The default values for the options are determined by the value of the `$PSSessionOption` preference -variable, if it is set. Otherwise, the default values are established by options set in the session +variable, if it's set. Otherwise, the default values are established by options set in the session configuration. The session option values take precedence over default values for sessions set in the -`$PSSessionOption` preference variable and in the session configuration. However, they do not take +`$PSSessionOption` preference variable and in the session configuration. However, they don't take precedence over maximum values, quotas or limits set in the session configuration. For a description of the session options, including the default values, see `New-PSSessionOption`. @@ -800,10 +805,10 @@ Accept wildcard characters: False Specifies the SSH subsystem used for the new **PSSession**. This specifies the subsystem to use on the target as defined in sshd_config. The subsystem starts a -specific version of PowerShell with predefined parameters. If the specified subsystem does not exist +specific version of PowerShell with predefined parameters. If the specified subsystem doesn't exist on the remote computer, the command fails. -If this parameter is not used, the default is the 'powershell' subsystem. +If this parameter isn't used, the default is the `powershell` subsystem. ```yaml Type: System.String @@ -820,19 +825,16 @@ Accept wildcard characters: False ### -UserName Specifies the user name for the account used to create a session on the remote computer. User -authentication method will depend on how Secure Shell (SSH) is configured on the remote computer. +authentication method depends on how Secure Shell (SSH) is configured on the remote computer. -If SSH is configured for basic password authentication then you will be prompted for the user -password. +If SSH is configured for basic password authentication then you are prompted for the user password. -If SSH is configured for key based user authentication then a key file path can be provided via the -**KeyFilePath** parameter and no password prompt will occur. Note that if the client user key file -is located in an SSH known location then the **KeyFilePath** parameter is not needed for key based -authentication, and user authentication will occur automatically based on the user name. See SSH -documentation about key based user authentication for more information. +If SSH is configured for key based user authentication then uou aren't prompted for a password. You +must provide a path to an SSH key file. If the user key file is located in an SSH known location +then the **KeyFilePath** parameter isn't needed. User authentication occurs automatically based on +the user name. See SSH documentation about key based user authentication for more information. -This is not a required parameter. If no **UserName** parameter is specified then the current log on -user name is used for the connection. +If the **UserName** parameter isn't specified then the current logged on username is used. This parameter was introduced in PowerShell 6.0. @@ -851,13 +853,13 @@ Accept wildcard characters: False ### -UseSSL Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to establish a connection to -the remote computer. By default, SSL is not used. +the remote computer. By default, SSL isn't used. WS-Management encrypts all PowerShell content transmitted over the network. The **UseSSL** parameter is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. -If you use this parameter, but SSL is not available on the port that is used for the command, the +If you use this parameter, but SSL isn't available on the port that's used for the command, the command fails. ```yaml @@ -946,7 +948,7 @@ to change the command prompt, run before the remote prompt is displayed. find the local UI culture, use the `$UICulture` automatic variable. `Enter-PSSession` requires the `Get-Command`, `Out-Default`, and `Exit-PSSession` cmdlets. If these -cmdlets are not included in the session configuration on the remote computer, the `Enter-PSSession` +cmdlets aren't included in the session configuration on the remote computer, the `Enter-PSSession` commands fails. Unlike `Invoke-Command`, which parses and interprets the commands before it sends them to the remote @@ -961,13 +963,13 @@ The **HostName** parameter set was included starting with PowerShell 6.0. It was PowerShell remoting based on Secure Shell (SSH). Both SSH and PowerShell are supported on multiple platforms (Windows, Linux, macOS) and PowerShell remoting works over these platforms where PowerShell and SSH are installed and configured. This is separate from the previous Windows only -remoting that is based on WinRM and much of the WinRM specific features and limitations do not +remoting that's based on WinRM and much of the WinRM specific features and limitations don't apply. For example, WinRM based quotas, session options, custom endpoint configuration, and disconnect/reconnect features are currently not supported. For more information about how to set up PowerShell SSH remoting, see [PowerShell Remoting Over SSH](/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core). -Prior to PowerShell 7.1, remoting over SSH did not support second-hop remote sessions. This +Prior to PowerShell 7.1, remoting over SSH didn't support second-hop remote sessions. This capability was limited to sessions using WinRM. PowerShell 7.1 allows `Enter-PSSession` and `Enter-PSHostProcess` to work from within any interactive remote session. diff --git a/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md index 4a69085a950..5599d923a6c 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enter-pssession?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: Enter-PSSession @@ -66,7 +66,8 @@ Enter-PSSession [-Name ] [] ### VMId ``` -Enter-PSSession [-VMId] [-Credential] [-ConfigurationName ] [] +Enter-PSSession [-VMId] [-Credential] [-ConfigurationName ] + [] ``` ### VMName @@ -85,13 +86,13 @@ Enter-PSSession [-ContainerId] [-ConfigurationName ] [-RunAsAdm ## DESCRIPTION -The `Enter-PSSession` cmdlet starts an interactive session with a single remote computer. -During the session, the commands that you type run on the remote computer, just as if you were -typing directly on the remote computer. You can have only one interactive session at a time. +The `Enter-PSSession` cmdlet starts an interactive session with a single remote computer. During the +session, the commands that you type run on the remote computer, just as if you were typing directly +on the remote computer. You can have only one interactive session at a time. Typically, you use the **ComputerName** parameter to specify the name of the remote computer. However, you can also use a session that you create by using the `New-PSSession` cmdlet for the -interactive session. However, you cannot use the `Disconnect-PSSession`, `Connect-PSSession`, or +interactive session. However, you can't use the `Disconnect-PSSession`, `Connect-PSSession`, or `Receive-PSSession` cmdlets to disconnect from or re-connect to an interactive session. Starting with PowerShell 6.0 you can use Secure Shell (SSH) to establish a connection to a remote @@ -105,6 +106,10 @@ information about how to set up PowerShell SSH remoting, see To end the interactive session and disconnect from the remote computer, use the `Exit-PSSession` cmdlet, or type `exit`. +> [!IMPORTANT] +> `Enter-PSSession` is designed to substitute a new remote session for the current interactive +> session. You shouldn't call it from within script context. + ## EXAMPLES ### Example 1: Start an interactive session @@ -130,7 +135,7 @@ The command is submitted to the remote computer, and the file is saved on the re The third command uses the **Exit** keyword to end the interactive session and close the connection. The fourth command confirms that the Process.txt file is on the remote computer. A `Get-ChildItem` -("dir") command on the local computer cannot find the file. +("dir") command on the local computer can't find the file. ```powershell PS C:\> Enter-PSSession -ComputerName Server01 @@ -222,10 +227,10 @@ connection to the remote system. ### -AllowRedirection Allows redirection of this connection to an alternate Uniform Resource Identifier (URI). By default, -redirection is not allowed. +redirection isn't allowed. When you use the **ConnectionURI** parameter, the remote destination can return an instruction to -redirect to a different URI. By default, PowerShell does not redirect connections, but you can use +redirect to a different URI. By default, PowerShell doesn't redirect connections, but you can use this parameter to allow it to redirect the connection. You can also limit the number of times the connection is redirected by changing the @@ -248,10 +253,10 @@ Accept wildcard characters: False ### -ApplicationName Specifies the application name segment of the connection URI. Use this parameter to specify the -application name when you are not using the **ConnectionURI** parameter in the command. +application name when you aren't using the **ConnectionURI** parameter in the command. The default value is the value of the `$PSSessionApplicationName` preference variable on the local -computer. If this preference variable is not defined, the default value is WSMAN. This value is +computer. If this preference variable isn't defined, the default value is WSMAN. This value is appropriate for most uses. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). @@ -273,7 +278,7 @@ Accept wildcard characters: False ### -Authentication -Specifies the mechanism that is used to authenticate the user's credentials. The acceptable values +Specifies the mechanism that's used to authenticate the user's credentials. The acceptable values for this parameter are: - Default @@ -318,7 +323,7 @@ Specifies the digital public key certificate (X509) of a user account that has p this action. Enter the certificate thumbprint of the certificate. Certificates are used in client certificate-based authentication. They can be mapped only to local -user accounts; they do not work with domain accounts. +user accounts; they don't work with domain accounts. To get a certificate, use the `Get-Item` or `Get-ChildItem` command in the PowerShell Cert: drive. @@ -367,7 +372,7 @@ Accept wildcard characters: False ### -ConfigurationName -Specifies the session configuration that is used for the interactive session. +Specifies the session configuration that's used for the interactive session. Enter a configuration name or the fully qualified resource URI for a session configuration. If you specify only the configuration name, the following schema URI is prepended: @@ -377,10 +382,10 @@ When used with SSH, this specifies the subsystem to use on the target as defined default value for SSH is the `powershell` subsystem. The session configuration for a session is located on the remote computer. If the specified session -configuration does not exist on the remote computer, the command fails. +configuration doesn't exist on the remote computer, the command fails. The default value is the value of the `$PSSessionConfigurationName` preference variable on the local -computer. If this preference variable is not set, the default is Microsoft.PowerShell. For more +computer. If this preference variable isn't set, the default is Microsoft.PowerShell. For more information, see [about_Preference_Variables](About/about_Preference_Variables.md). ```yaml @@ -425,11 +430,11 @@ The default value is as follows: `http://localhost:5985/WSMAN` -If you do not specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, +If you don't specify a **ConnectionURI**, you can use the **UseSSL**, **ComputerName**, **Port**, and **ApplicationName** parameters to specify the **ConnectionURI** values. Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection -URI with a Transport segment, but do not specify a port, the session is created by using standards +URI with a Transport segment, but don't specify a port, the session is created by using standards ports: 80 for HTTP and 443 for HTTPS. To use the default ports for PowerShell remoting, specify port 5985 for HTTP or 5986 for HTTPS. @@ -662,7 +667,7 @@ Accept wildcard characters: False ### -Port -Specifies the network port on the remote computer that is used for this command. +Specifies the network port on the remote computer that's used for this command. In PowerShell 6.0 this parameter was included in the **HostName** parameter set which supports Secure Shell (SSH) connections. @@ -679,7 +684,7 @@ listen at that port. Use the following commands to configure the listener: 1. `winrm delete winrm/config/listener?Address=*+Transport=HTTP` 2. `winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="\"}` -Do not use the **Port** parameter unless you must. The port setting in the command applies to all +Don't use the **Port** parameter unless you must. The port setting in the command applies to all computers or sessions on which the command runs. An alternate port setting might prevent the command from running on all computers. @@ -749,11 +754,11 @@ by using the `New-PSSessionOption` cmdlet, or a hash table in which the keys are names and the values are session option values. The default values for the options are determined by the value of the `$PSSessionOption` preference -variable, if it is set. Otherwise, the default values are established by options set in the session +variable, if it's set. Otherwise, the default values are established by options set in the session configuration. The session option values take precedence over default values for sessions set in the -`$PSSessionOption` preference variable and in the session configuration. However, they do not take +`$PSSessionOption` preference variable and in the session configuration. However, they don't take precedence over maximum values, quotas or limits set in the session configuration. For a description of the session options, including the default values, see `New-PSSessionOption`. @@ -800,10 +805,10 @@ Accept wildcard characters: False Specifies the SSH subsystem used for the new **PSSession**. This specifies the subsystem to use on the target as defined in sshd_config. The subsystem starts a -specific version of PowerShell with predefined parameters. If the specified subsystem does not exist +specific version of PowerShell with predefined parameters. If the specified subsystem doesn't exist on the remote computer, the command fails. -If this parameter is not used, the default is the 'powershell' subsystem. +If this parameter isn't used, the default is the `powershell` subsystem. ```yaml Type: System.String @@ -820,19 +825,16 @@ Accept wildcard characters: False ### -UserName Specifies the user name for the account used to create a session on the remote computer. User -authentication method will depend on how Secure Shell (SSH) is configured on the remote computer. +authentication method depends on how Secure Shell (SSH) is configured on the remote computer. -If SSH is configured for basic password authentication then you will be prompted for the user -password. +If SSH is configured for basic password authentication then you are prompted for the user password. -If SSH is configured for key based user authentication then a key file path can be provided via the -**KeyFilePath** parameter and no password prompt will occur. Note that if the client user key file -is located in an SSH known location then the **KeyFilePath** parameter is not needed for key based -authentication, and user authentication will occur automatically based on the user name. See SSH -documentation about key based user authentication for more information. +If SSH is configured for key based user authentication then uou aren't prompted for a password. You +must provide a path to an SSH key file. If the user key file is located in an SSH known location +then the **KeyFilePath** parameter isn't needed. User authentication occurs automatically based on +the user name. See SSH documentation about key based user authentication for more information. -This is not a required parameter. If no **UserName** parameter is specified then the current log on -user name is used for the connection. +If the **UserName** parameter isn't specified then the current logged on username is used. This parameter was introduced in PowerShell 6.0. @@ -851,13 +853,13 @@ Accept wildcard characters: False ### -UseSSL Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to establish a connection to -the remote computer. By default, SSL is not used. +the remote computer. By default, SSL isn't used. WS-Management encrypts all PowerShell content transmitted over the network. The **UseSSL** parameter is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. -If you use this parameter, but SSL is not available on the port that is used for the command, the +If you use this parameter, but SSL isn't available on the port that's used for the command, the command fails. ```yaml @@ -946,7 +948,7 @@ to change the command prompt, run before the remote prompt is displayed. find the local UI culture, use the `$UICulture` automatic variable. `Enter-PSSession` requires the `Get-Command`, `Out-Default`, and `Exit-PSSession` cmdlets. If these -cmdlets are not included in the session configuration on the remote computer, the `Enter-PSSession` +cmdlets aren't included in the session configuration on the remote computer, the `Enter-PSSession` commands fails. Unlike `Invoke-Command`, which parses and interprets the commands before it sends them to the remote @@ -961,13 +963,13 @@ The **HostName** parameter set was included starting with PowerShell 6.0. It was PowerShell remoting based on Secure Shell (SSH). Both SSH and PowerShell are supported on multiple platforms (Windows, Linux, macOS) and PowerShell remoting works over these platforms where PowerShell and SSH are installed and configured. This is separate from the previous Windows only -remoting that is based on WinRM and much of the WinRM specific features and limitations do not +remoting that's based on WinRM and much of the WinRM specific features and limitations don't apply. For example, WinRM based quotas, session options, custom endpoint configuration, and disconnect/reconnect features are currently not supported. For more information about how to set up PowerShell SSH remoting, see [PowerShell Remoting Over SSH](/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core). -Prior to PowerShell 7.1, remoting over SSH did not support second-hop remote sessions. This +Prior to PowerShell 7.1, remoting over SSH didn't support second-hop remote sessions. This capability was limited to sessions using WinRM. PowerShell 7.1 allows `Enter-PSSession` and `Enter-PSHostProcess` to work from within any interactive remote session. From ae839fd47c767fefa028e4526e6aebd3fea230a5 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 14 Jun 2024 10:29:18 -0500 Subject: [PATCH 2/3] Improve wording to allow for better translations (#11190) --- .../About/about_Regular_Expressions.md | 14 +++---- .../About/about_Regular_Expressions.md | 14 +++---- .../About/about_Regular_Expressions.md | 14 +++---- .../About/about_Regular_Expressions.md | 14 +++---- .../install/PowerShell-Support-Lifecycle.md | 42 +++++++++---------- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md index 8a75410527d..ccdf1be3041 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md @@ -1,7 +1,7 @@ --- description: Describes regular expressions in PowerShell. Locale: en-US -ms.date: 04/17/2024 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Regular Expressions @@ -14,8 +14,8 @@ Describes regular expressions in PowerShell. ## Long description > [!NOTE] -> This article will show you the syntax and methods for using regular -> expressions in PowerShell, not all syntax is discussed. For a more complete +> This article shows the syntax and methods for using regular expressions in +> PowerShell. It doesn't cover all possible expressions. For a more complete > reference, see the [Regular Expression Language - Quick Reference][03]. A regular expression is a pattern used to match text. It can be made up of @@ -193,9 +193,9 @@ characters. ``` > [!NOTE] -> When defining a regex containing an `$` anchor, be sure to enclose the regex -> using single quotes (`'`) instead of double quotes (`"`) or PowerShell will -> expand the expression as a variable. +> When defining a regex containing an anchor (`$` ), you should enclose the +> regex in single quotes (`'`). If you use double quotes (`"`), PowerShell +> interprets the string as an expandable variable expression. When using anchors in PowerShell, you should understand the difference between **Singleline** and **Multiline** regular expression options. @@ -273,7 +273,7 @@ True ``` Use the `$Matches` **Hashtable** automatic variable to retrieve captured text. -The text representing the entire match is stored at key `0`. It is important to +The text representing the entire match is stored at key `0`. It's important to note that the `$Matches` hashtable contains only the first occurrence of any matching pattern. diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md index e302a8ce724..b48c770f9b3 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md @@ -1,7 +1,7 @@ --- description: Describes regular expressions in PowerShell. Locale: en-US -ms.date: 04/17/2024 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Regular Expressions @@ -14,8 +14,8 @@ Describes regular expressions in PowerShell. ## Long description > [!NOTE] -> This article will show you the syntax and methods for using regular -> expressions in PowerShell, not all syntax is discussed. For a more complete +> This article shows the syntax and methods for using regular expressions in +> PowerShell. It doesn't cover all possible expressions. For a more complete > reference, see the [Regular Expression Language - Quick Reference][03]. A regular expression is a pattern used to match text. It can be made up of @@ -193,9 +193,9 @@ characters. ``` > [!NOTE] -> When defining a regex containing an `$` anchor, be sure to enclose the regex -> using single quotes (`'`) instead of double quotes (`"`) or PowerShell will -> expand the expression as a variable. +> When defining a regex containing an anchor (`$` ), you should enclose the +> regex in single quotes (`'`). If you use double quotes (`"`), PowerShell +> interprets the string as an expandable variable expression. When using anchors in PowerShell, you should understand the difference between **Singleline** and **Multiline** regular expression options. @@ -273,7 +273,7 @@ True ``` Use the `$Matches` **Hashtable** automatic variable to retrieve captured text. -The text representing the entire match is stored at key `0`. It is important to +The text representing the entire match is stored at key `0`. It's important to note that the `$Matches` hashtable contains only the first occurrence of any matching pattern. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md index 17403c0aab3..fb4a4f04fe1 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md @@ -1,7 +1,7 @@ --- description: Describes regular expressions in PowerShell. Locale: en-US -ms.date: 04/17/2024 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Regular Expressions @@ -14,8 +14,8 @@ Describes regular expressions in PowerShell. ## Long description > [!NOTE] -> This article will show you the syntax and methods for using regular -> expressions in PowerShell, not all syntax is discussed. For a more complete +> This article shows the syntax and methods for using regular expressions in +> PowerShell. It doesn't cover all possible expressions. For a more complete > reference, see the [Regular Expression Language - Quick Reference][03]. A regular expression is a pattern used to match text. It can be made up of @@ -193,9 +193,9 @@ characters. ``` > [!NOTE] -> When defining a regex containing an `$` anchor, be sure to enclose the regex -> using single quotes (`'`) instead of double quotes (`"`) or PowerShell will -> expand the expression as a variable. +> When defining a regex containing an anchor (`$` ), you should enclose the +> regex in single quotes (`'`). If you use double quotes (`"`), PowerShell +> interprets the string as an expandable variable expression. When using anchors in PowerShell, you should understand the difference between **Singleline** and **Multiline** regular expression options. @@ -273,7 +273,7 @@ True ``` Use the `$Matches` **Hashtable** automatic variable to retrieve captured text. -The text representing the entire match is stored at key `0`. It is important to +The text representing the entire match is stored at key `0`. It's important to note that the `$Matches` hashtable contains only the first occurrence of any matching pattern. diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md index 0096e9d6b41..f94c91e9d62 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Regular_Expressions.md @@ -1,7 +1,7 @@ --- description: Describes regular expressions in PowerShell. Locale: en-US -ms.date: 04/17/2024 +ms.date: 06/14/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Regular Expressions @@ -14,8 +14,8 @@ Describes regular expressions in PowerShell. ## Long description > [!NOTE] -> This article will show you the syntax and methods for using regular -> expressions in PowerShell, not all syntax is discussed. For a more complete +> This article shows the syntax and methods for using regular expressions in +> PowerShell. It doesn't cover all possible expressions. For a more complete > reference, see the [Regular Expression Language - Quick Reference][03]. A regular expression is a pattern used to match text. It can be made up of @@ -193,9 +193,9 @@ characters. ``` > [!NOTE] -> When defining a regex containing an `$` anchor, be sure to enclose the regex -> using single quotes (`'`) instead of double quotes (`"`) or PowerShell will -> expand the expression as a variable. +> When defining a regex containing an anchor (`$` ), you should enclose the +> regex in single quotes (`'`). If you use double quotes (`"`), PowerShell +> interprets the string as an expandable variable expression. When using anchors in PowerShell, you should understand the difference between **Singleline** and **Multiline** regular expression options. @@ -273,7 +273,7 @@ True ``` Use the `$Matches` **Hashtable** automatic variable to retrieve captured text. -The text representing the entire match is stored at key `0`. It is important to +The text representing the entire match is stored at key `0`. It's important to note that the `$Matches` hashtable contains only the first occurrence of any matching pattern. diff --git a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md index d3f2a7e4687..36283136a22 100644 --- a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md +++ b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md @@ -110,10 +110,10 @@ guarantees of responsiveness or fixes. The PowerShell support lifecycle follows the [support lifecycle of .NET][06]. The following table lists the end-of-support dates for the current versions of PowerShell: -| Version | Release Date | End-of-support | -| ------------------ | ----------------- | ----------------- | -| 7.4 (LTS-current) | November 16, 2023 | November 10, 2026 | -| 7.2 (LTS-previous) | November 8, 2021 | November 8, 2024 | +| Version | Release Date | End-of-support | +| --------- | ----------------- | ----------------- | +| 7.4 (LTS) | November 16, 2023 | November 10, 2026 | +| 7.2 (LTS) | November 8, 2021 | November 8, 2024 | The following table lists the end-of-support dates for retired versions of PowerShell: @@ -130,23 +130,23 @@ The following table lists the end-of-support dates for retired versions of Power The following table contains a historical timeline of the major releases of PowerShell. -| Version | Release Date | Note | -| ----------------------------- | :----------: | -------------------------------------------------------------------------- | -| PowerShell 7.5 (preview) | Future | Built on [.NET 9.0.0][14] | -| PowerShell 7.4 (LTS-current) | Nov-2023 | Built on [.NET 8.0.0][13] | -| PowerShell 7.3 | Nov-2022 | Built on [.NET 7.0][12] | -| PowerShell 7.2 (LTS-previous) | Nov-2021 | Built on [.NET 6.0][11] | -| PowerShell 7.1 | Nov-2020 | Built on [.NET 5.0][10] | -| PowerShell 7.0 (LTS) | Mar-2020 | Built on [.NET Core 3.1][09] | -| PowerShell 6.2 | Mar-2019 | Built on [.NET Core 2.1][08] | -| PowerShell 6.1 | Sep-2018 | Built on [.NET Core 2.1][08] | -| PowerShell 6.0 | Jan-2018 | Built on [.NET Core 2.0][07]. Installable on Windows, Linux, and macOS | -| Windows PowerShell 5.1 | Aug-2016 | Released in Windows 10 Anniversary Update and Windows Server 2016, WMF 5.1 | -| Windows PowerShell 5.0 | Feb-2016 | Released in Windows Management Framework (WMF) 5.0 | -| Windows PowerShell 4.0 | Oct-2013 | Released in Windows 8.1 and with Windows Server 2012 R2, WMF 4.0 | -| Windows PowerShell 3.0 | Oct-2012 | Released in Windows 8 and with Windows Server 2012 WMF 3.0 | -| Windows PowerShell 2.0 | Jul-2009 | Released in Windows 7 and Windows Server 2008 R2, WMF 2.0 | -| Windows PowerShell 1.0 | Nov-2006 | Released as optional component of Windows Server 2008 | +| Version | Release Date | Note | +| ------------------------ | :----------: | -------------------------------------------------------------------------- | +| PowerShell 7.5 (preview) | Future | Built on [.NET 9.0.0][14] | +| PowerShell 7.4 (LTS) | Nov-2023 | Built on [.NET 8.0.0][13] | +| PowerShell 7.3 | Nov-2022 | Built on [.NET 7.0][12] | +| PowerShell 7.2 (LTS) | Nov-2021 | Built on [.NET 6.0][11] | +| PowerShell 7.1 | Nov-2020 | Built on [.NET 5.0][10] | +| PowerShell 7.0 (LTS) | Mar-2020 | Built on [.NET Core 3.1][09] | +| PowerShell 6.2 | Mar-2019 | Built on [.NET Core 2.1][08] | +| PowerShell 6.1 | Sep-2018 | Built on [.NET Core 2.1][08] | +| PowerShell 6.0 | Jan-2018 | Built on [.NET Core 2.0][07]. Installable on Windows, Linux, and macOS | +| Windows PowerShell 5.1 | Aug-2016 | Released in Windows 10 Anniversary Update and Windows Server 2016, WMF 5.1 | +| Windows PowerShell 5.0 | Feb-2016 | Released in Windows Management Framework (WMF) 5.0 | +| Windows PowerShell 4.0 | Oct-2013 | Released in Windows 8.1 and with Windows Server 2012 R2, WMF 4.0 | +| Windows PowerShell 3.0 | Oct-2012 | Released in Windows 8 and with Windows Server 2012 WMF 3.0 | +| Windows PowerShell 2.0 | Jul-2009 | Released in Windows 7 and Windows Server 2008 R2, WMF 2.0 | +| Windows PowerShell 1.0 | Nov-2006 | Released as optional component of Windows Server 2008 | Run the following command to see the full version number of .NET used by the version of PowerShell you're running: From 31d3f5f503e0aa67feae6b78478503d378f50465 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 14 Jun 2024 13:25:58 -0500 Subject: [PATCH 3/3] fix typo and add clarification (#11191) --- reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md | 5 +++-- reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md | 7 ++++--- reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md | 7 ++++--- reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md | 7 ++++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md index fa29dc557b1..e89cb9842e2 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -90,8 +90,9 @@ To end the interactive session and disconnect from the remote computer, use the cmdlet, or type `exit`. > [!IMPORTANT] -> `Enter-PSSession` is designed to substitute a new remote session for the current interactive -> session. You shouldn't call it from within script context. +> `Enter-PSSession` is designed to substitute the current interactive session with a new interactive +> remote session. You shouldn't call it from within a function or script or by passing it as a +> command to the `powershell.exe` executable. ## EXAMPLES diff --git a/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md index ef339b8518c..011ba83abfc 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/7.2/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -95,7 +95,7 @@ interactive session. However, you can't use the `Disconnect-PSSession`, `Connect `Receive-PSSession` cmdlets to disconnect from or re-connect to an interactive session. Starting with PowerShell 6.0 you can use Secure Shell (SSH) to establish a connection to a remote -computer, if SSH is available on the local computer and the remote computer is configured with a +computer. You must have SSH on the local computer and the remote computer must be configured with a PowerShell SSH endpoint. The benefit an SSH based PowerShell remote session is that it works across multiple platforms (Windows, Linux, macOS). For SSH based remoting you use the **HostName** parameter set to specify the remote computer and relevant connection information. For more @@ -106,8 +106,9 @@ To end the interactive session and disconnect from the remote computer, use the cmdlet, or type `exit`. > [!IMPORTANT] -> `Enter-PSSession` is designed to substitute a new remote session for the current interactive -> session. You shouldn't call it from within script context. +> `Enter-PSSession` is designed to substitute the current interactive session with a new interactive +> remote session. You shouldn't call it from within a function or script or by passing it as a +> command to the `pwsh` executable. ## EXAMPLES diff --git a/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md index 208ab3f2617..c2ed05a744c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -96,7 +96,7 @@ interactive session. However, you can't use the `Disconnect-PSSession`, `Connect `Receive-PSSession` cmdlets to disconnect from or re-connect to an interactive session. Starting with PowerShell 6.0 you can use Secure Shell (SSH) to establish a connection to a remote -computer, if SSH is available on the local computer and the remote computer is configured with a +computer. You must have SSH on the local computer and the remote computer must be configured with a PowerShell SSH endpoint. The benefit an SSH based PowerShell remote session is that it works across multiple platforms (Windows, Linux, macOS). For SSH based remoting you use the **HostName** parameter set to specify the remote computer and relevant connection information. For more @@ -107,8 +107,9 @@ To end the interactive session and disconnect from the remote computer, use the cmdlet, or type `exit`. > [!IMPORTANT] -> `Enter-PSSession` is designed to substitute a new remote session for the current interactive -> session. You shouldn't call it from within script context. +> `Enter-PSSession` is designed to substitute the current interactive session with a new interactive +> remote session. You shouldn't call it from within a function or script or by passing it as a +> command to the `pwsh` executable. ## EXAMPLES diff --git a/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md b/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md index 5599d923a6c..7e418611d4c 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Enter-PSSession.md @@ -96,7 +96,7 @@ interactive session. However, you can't use the `Disconnect-PSSession`, `Connect `Receive-PSSession` cmdlets to disconnect from or re-connect to an interactive session. Starting with PowerShell 6.0 you can use Secure Shell (SSH) to establish a connection to a remote -computer, if SSH is available on the local computer and the remote computer is configured with a +computer. You must have SSH on the local computer and the remote computer must be configured with a PowerShell SSH endpoint. The benefit an SSH based PowerShell remote session is that it works across multiple platforms (Windows, Linux, macOS). For SSH based remoting you use the **HostName** parameter set to specify the remote computer and relevant connection information. For more @@ -107,8 +107,9 @@ To end the interactive session and disconnect from the remote computer, use the cmdlet, or type `exit`. > [!IMPORTANT] -> `Enter-PSSession` is designed to substitute a new remote session for the current interactive -> session. You shouldn't call it from within script context. +> `Enter-PSSession` is designed to substitute the current interactive session with a new interactive +> remote session. You shouldn't call it from within a function or script or by passing it as a +> command to the `pwsh` executable. ## EXAMPLES