Skip to content

Sync changes to about_* articles #11736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions reference/5.1/Microsoft.PowerShell.Core/About/About.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ Describes the PowerShell debugger.

### [about_DesiredStateConfiguration](about_DesiredStateConfiguration.md)

Provides a brief introduction to the PowerShell Desired State Configuration (DSC) feature.
Provides a brief introduction to the PowerShell Desired State Configuration
(DSC) feature.

### [about_Do](about_Do.md)

Expand Down Expand Up @@ -221,7 +222,8 @@ Describes the attribute that makes a function work like a compiled cmdlet.

### [about_Functions_OutputTypeAttribute](about_Functions_OutputTypeAttribute.md)

Describes an attribute that reports the type of object that the function returns.
Describes an attribute that reports the type of object that the function
returns.

### [about_Functions](about_Functions.md)

Expand Down Expand Up @@ -370,7 +372,8 @@ Combining commands into pipelines in the PowerShell

### [about_PowerShell_exe](about_PowerShell_exe.md)

Explains how to use the `powershell.exe` command-line interface. Displays the command-line parameters and describes the syntax.
Explains how to use the `powershell.exe` command-line interface. Displays the
command-line parameters and describes the syntax.

### [about_PowerShell_Ise_exe](about_PowerShell_Ise_exe.md)

Expand Down Expand Up @@ -630,20 +633,25 @@ Describes new features that are included in Windows PowerShell 5.1.

### [about_Windows_PowerShell_ISE](about_Windows_PowerShell_ISE.md)

Describes the features and system requirements of Windows PowerShell Integrated Scripting Environment (ISE).
Describes the features and system requirements of Windows PowerShell Integrated
Scripting Environment (ISE).

### [about_Windows_RT](about_Windows_RT.md)

Explains limitations of Windows PowerShell 4.0 on Windows RT 8.1.

### [about_WMI_Cmdlets](about_WMI_Cmdlets.md)

Provides background information about Windows Management Instrumentation (WMI) and Windows PowerShell.
Provides background information about Windows Management Instrumentation (WMI)
and Windows PowerShell.

### [about_WMI](about_WMI.md)

Windows Management Instrumentation (WMI) uses the Common Information Model (CIM) to represent systems, applications, networks, devices, and other manageable components of the modern enterprise.
Windows Management Instrumentation (WMI) uses the Common Information Model
(CIM) to represent systems, applications, networks, devices, and other
manageable components of the modern enterprise.

### [about_WQL](about_WQL.md)

Describes WMI Query Language (WQL), which can be used to get WMI objects in Windows PowerShell.
Describes WMI Query Language (WQL), which can be used to get WMI objects in
Windows PowerShell.

Large diffs are not rendered by default.

148 changes: 80 additions & 68 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_PSSessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,78 +11,75 @@ title: about_PSSessions

## Short description

Describes Windows PowerShell sessions (PSSessions) and explains how to
establish a persistent connection to a remote computer.
Describes PowerShell sessions (PSSessions) and explains how to establish a
persistent connection to a remote computer.

## Long description

To run Windows PowerShell commands on a remote computer, you can use the
**ComputerName** parameter of a cmdlet, or you can create a Windows PowerShell
session (PSSession) and run commands in the PSSession.
To run PowerShell commands on a remote computer, you can use the
**ComputerName** parameter of a cmdlet, or you can create a PowerShell session
(PSSession) and run commands in the PSSession.

When you create a PSSession, Windows PowerShell establishes a persistent
connection to the remote computer. Use a PSSession to run a series of related
commands on a remote computer. Commands that run in the same PSSession can
share data, such as the values of variables, aliases, and functions.
When you create a PSSession, PowerShell establishes a persistent connection to
the remote computer. Use a PSSession to run a series of related commands on a
remote computer. Commands that run in the same PSSession can share data, such
as the values of variables, aliases, and functions.

You can also create a PSSession on the local computer and run commands in it.
A local PSSession uses the Windows PowerShell remoting infrastructure to
create and maintain the PSSession.
A local PSSession uses the PowerShell remoting infrastructure to create and
maintain the PSSession.

Beginning in Windows PowerShell 3.0, PSSessions are independent of the
sessions in which they are created. Active PSSessions are maintained on the
remote computer (or the computer at the remote end or "server-side" of the
connection). As a result, you can disconnect from the PSSession and reconnect
to it at a later time from the same computer or from a different computer.
Beginning in Windows PowerShell 3.0, PSSessions on Windows are independent
of the sessions in which they are created. Active PSSessions are maintained
on the remote computer (or the computer at the remote end or "server-side"
of the connection). As a result, on Windows you can disconnect from a PSSession
on a remote Windows computer and reconnect to it at a later time from the
same computer or from a different Windows computer.

This topic explains how to create, use, get, and delete PSSessions. For more
advanced information, see
[about_PSSession_Details](about_PSSession_Details.md).
advanced information, see [about_PSSession_Details][01].

Note: PSSessions use the Windows PowerShell remoting infrastructure. To use
PSSessions, the local and remote computers must be configured for remoting.
For more information, see
[about_Remote_Requirements](about_Remote_Requirements.md).
Note: PSSessions use the PowerShell remoting infrastructure. To use PSSessions,
the local and remote computers must be configured for remoting. For more
information, see [about_Remote_Requirements][02].

In Windows Vista and later versions of Windows, to create a PSSession on a
local computer, you must start Windows PowerShell with the "Run as
administrator" option.
local computer, you must start PowerShell with the "Run as administrator"
option.

## What Is a Session?

A session is an environment in which Windows PowerShell runs.
A session is an environment in which PowerShell runs.

Each time you start Windows PowerShell, a session is created for you, and you
can run commands in the session. You can also add items to your session, such
as modules and snap-ins, and you can create items, such as variables,
functions, and aliases. These items exist only in the session and are deleted
when the session ends.
Each time you start PowerShell, a session is created for you, and you can run
commands in the session. You can also add items to your session, such as
modules and snap-ins, and you can create items, such as variables, functions,
and aliases. These items exist only in the session and are deleted when the
session ends.

You can also create user-managed sessions, known as " Windows PowerShell
sessions" or "PSSessions," on the local computer or on a remote computer. Like
the default session, you can run commands in a PSSession and add and create
items. However, unlike the session that starts automatically, you can control
the PSSessions that you create. You can get, create, configure, and remove
them, disconnect and reconnect to them, and run multiple commands in the same
PSSession. The PSSession remains available until you delete it or it times
out.
You can also create user-managed sessions, known as "PowerShell sessions" or
"PSSessions," on the local computer or on a remote computer. Like the default
session, you can run commands in a PSSession and add and create items.
However, unlike the session that starts automatically, you can control the
PSSessions that you create. You can get, create, configure, and remove them,
disconnect and reconnect to them, and run multiple commands in the same
PSSession. The PSSession remains available until you delete it or it times out.

Typically, you create a PSSession to run a series of related commands on a
remote computer. When you create a PSSession on a remote computer, Windows
PowerShell establishes a persistent connection to the remote computer to
support the session.
remote computer. When you create a PSSession on a remote computer, PowerShell
establishes a persistent connection to the remote computer to support the
session.

If you use the **ComputerName** parameter of the `Invoke-Command` or
`Enter-PSSession` cmdlet to run a remote command or to start an interactive
session, Windows PowerShell creates a temporary session on the remote computer
and closes the session as soon as the command is complete or as soon as the
session, PowerShell creates a temporary session on the remote computer and
closes the session as soon as the command is complete or as soon as the
interactive session ends. You cannot control these temporary sessions, and you
cannot use them for more than a single command or a single interactive
session.
cannot use them for more than a single command or a single interactive session.

In Windows PowerShell, the "current session" is the session that you are
working in. The "current session" can refer to any session, including a
temporary session or a PSSession.
In PowerShell, the "current session" is the session that you are working in.
The "current session" can refer to any session, including a temporary session
or a PSSession.

## Why Use a PSSession?

Expand All @@ -96,10 +93,9 @@ You can run remote commands without creating a PSSession. Use the
or a series of unrelated commands on one or many computers.

When you use the **ComputerName** parameter of `Invoke-Command` or
`Enter-PSSession`, Windows PowerShell establishes a temporary connection to
the remote computer and then closes the connection as soon as the command is
complete. Any data elements that you create are lost when the connection is
closed.
`Enter-PSSession`, PowerShell establishes a temporary connection to the remote
computer and then closes the connection as soon as the command is complete.
Any data elements that you create are lost when the connection is closed.

Other cmdlets that have a **ComputerName** parameter, such as `Get-Eventlog`
and `Get-WmiObject`, use different remoting technologies to gather data. None
Expand All @@ -108,8 +104,8 @@ create a persistent connection like a PSSession.
## How to Create a PSSession

To create a PSSession, use the `New-PSSession` cmdlet. To create the PSSession
on a remote computer, use the **ComputerName** parameter of the
`New-PSSession` cmdlet.
on a remote computer, use the **ComputerName** parameter of the `New-PSSession`
cmdlet.

For example, the following command creates a new PSSession on the Server01
computer.
Expand Down Expand Up @@ -151,7 +147,8 @@ To get the PSSessions that were created in your current session, use the
`Get-PSSession` cmdlet without the **ComputerName** parameter. `Get-PSSession`
returns the same type of object that `New-PSSession` returns.

The following command gets all the PSSessions that were created in the current session.
The following command gets all the PSSessions that were created in the current
session.

```powershell
Get-PSSession
Expand Down Expand Up @@ -239,7 +236,7 @@ until it times out.

You can also use the **IdleTimeout** parameter of the `New-PSSessionOption`
cmdlet to set an expiration time for an idle PSSession. For more information,
see [New-PSSessionOption](xref:Microsoft.PowerShell.Core.New-PSSessionOption).
see [New-PSSessionOption][03].

## The PSSession Cmdlets

Expand All @@ -261,18 +258,33 @@ Get-Help *-PSSession

## For More Information

For more information about PSSessions, see [about_PSSession_Details](about_PSSession_Details.md).
For more information about PSSessions, see [about_PSSession_Details][01].

## See also

- [about_Remote](about_Remote.md)
- [about_Remote_Disconnected_Sessions](about_Remote_Disconnected_Sessions.md)
- [about_Remote_Requirements](about_Remote_Requirements.md)
- [Invoke-Command](xref:Microsoft.PowerShell.Core.Invoke-Command)
- [Connect-PSSession](xref:Microsoft.PowerShell.Core.Connect-PSSession)
- [Disconnect-PSSession](xref:Microsoft.PowerShell.Core.Disconnect-PSSession)
- [Enter-PSSession](xref:Microsoft.PowerShell.Core.Enter-PSSession)
- [Exit-PSSession](xref:Microsoft.PowerShell.Core.Exit-PSSession)
- [Get-PSSession](xref:Microsoft.PowerShell.Core.Get-PSSession)
- [New-PSSession](xref:Microsoft.PowerShell.Core.New-PSSession)
- [Remove-PSSession](xref:Microsoft.PowerShell.Core.Remove-PSSession)
- [about_Remote][05]
- [about_Remote_Disconnected_Sessions][04]
- [about_Remote_Requirements][02]
- [Invoke-Command][06]
- [Connect-PSSession][07]
- [Disconnect-PSSession][08]
- [Enter-PSSession][09]
- [Exit-PSSession][10]
- [Get-PSSession][11]
- [New-PSSession][12]
- [Remove-PSSession][13]

<!-- link references -->
[01]: about_PSSession_Details.md
[02]: about_Remote_Requirements.md
[03]: xref:Microsoft.PowerShell.Core.New-PSSessionOption
[04]: about_Remote_Disconnected_Sessions.md
[05]: about_Remote.md
[06]: xref:Microsoft.PowerShell.Core.Invoke-Command
[07]: xref:Microsoft.PowerShell.Core.Connect-PSSession
[08]: xref:Microsoft.PowerShell.Core.Disconnect-PSSession
[09]: xref:Microsoft.PowerShell.Core.Enter-PSSession
[10]: xref:Microsoft.PowerShell.Core.Exit-PSSession
[11]: xref:Microsoft.PowerShell.Core.Get-PSSession
[12]: xref:Microsoft.PowerShell.Core.New-PSSession
[13]: xref:Microsoft.PowerShell.Core.Remove-PSSession
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ title: about_Quoting_Rules
# about_Quoting_Rules

## Short description

Describes rules for using single and double quotation marks in PowerShell.

## Long description
Expand Down Expand Up @@ -464,7 +465,7 @@ For more information about this behavior, see the [about_Parsing][03] article.
[01]: #including-quote-characters-in-a-string
[02]: about_Parsing.md#argument-mode
[03]: about_Parsing.md#passing-arguments-that-contain-quote-characters
[04]: about_preference_variables.md#ofs
[04]: about_Preference_Variables.md#ofs
[05]: about_Special_Characters.md
[06]: https://en.wikipedia.org/wiki/Quotation_marks_in_English#Smart_quotes
[07]: xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ title: about_Redirection
# about_Redirection

## Short description

Explains how to redirect output from PowerShell to text files.

## Long description

By default, PowerShell sends output to the PowerShell host. Usually this is the
console application. However, you can redirect the output to a text file and you
can redirect error output to the regular output stream.
console application. However, you can redirect the output to a text file and
you can redirect error output to the regular output stream.

You can use the following methods to redirect output:

Expand All @@ -26,9 +27,11 @@ You can use the following methods to redirect output:
- Use the `Tee-Object` cmdlet, which sends command output to a text file and
then sends it to the pipeline.

- Use the PowerShell redirection operators. Using the redirection operator with
a file target is functionally equivalent to piping to `Out-File` with no
extra parameters.
- Use the PowerShell redirection operators. Redirecting the output of a
PowerShell command (cmdlet, function, script) using the redirection operator
(`>`) is functionally equivalent to piping to `Out-File` with no extra
parameters.


For more information about streams, see [about_Output_Streams][04].

Expand Down Expand Up @@ -142,27 +145,27 @@ particular stream. The script in this example shows how the value of
```powershell
$ErrorActionPreference = 'Continue'
$ErrorActionPreference > log.txt
get-item /not-here 2>&1 >> log.txt
Get-Item /not-here 2>&1 >> log.txt

$ErrorActionPreference = 'SilentlyContinue'
$ErrorActionPreference >> log.txt
get-item /not-here 2>&1 >> log.txt
Get-Item /not-here 2>&1 >> log.txt

$ErrorActionPreference = 'Stop'
$ErrorActionPreference >> log.txt
Try {
get-item /not-here 2>&1 >> log.txt
Get-Item /not-here 2>&1 >> log.txt
}
catch {
"`tError caught!" >> log.txt
}
$ErrorActionPreference = 'Ignore'
$ErrorActionPreference >> log.txt
get-item /not-here 2>&1 >> log.txt
Get-Item /not-here 2>&1 >> log.txt

$ErrorActionPreference = 'Inquire'
$ErrorActionPreference >> log.txt
get-item /not-here 2>&1 >> log.txt
Get-Item /not-here 2>&1 >> log.txt

$ErrorActionPreference = 'Continue'
```
Expand Down Expand Up @@ -340,7 +343,7 @@ used. For more information, see the `-gt` operator in
[03]: about_Operators.md
[04]: about_Output_Streams.md
[05]: about_Path_Syntax.md
[06]: about_preference_variables.md#psdefaultparametervalues
[06]: about_Preference_Variables.md#psdefaultparametervalues
[07]: xref:Microsoft.PowerShell.Utility.Out-File
[08]: xref:Microsoft.PowerShell.Utility.Tee-Object
[09]: xref:Microsoft.PowerShell.Utility.Write-Debug
Expand Down
Loading