Updates from: 02/10/2022 06:34:34
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Core About Preference Variables (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Preference_Variables.md
--- description: Variables that customize the behavior of PowerShell. Locale: en-US Previously updated : 07/17/2021 Last updated : 02/09/2022 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Preference Variables
messages.
For more information about remote commands, see [about_Remote](about_Remote.md).
-### \$ConfirmPreference
+## \$ConfirmPreference
Determines whether PowerShell automatically prompts you for confirmation before running a cmdlet or function.
Valid values of `$ConfirmPreference`:
- **High**: PowerShell prompts for confirmation before running cmdlets or functions with a high risk.
-#### Detailed explanation
+### Detailed explanation
PowerShell can automatically prompt you for confirmation before doing an action. For example, when cmdlet or function significantly affects the system
is **High**, automatic confirmation rarely occurs. However, you can activate
automatic confirmation by changing the value of `$ConfirmPreference` to **Medium** or **Low**.
-#### Examples
+### Examples
This example shows the effect of the `$ConfirmPreference` variable's default value, **High**. The **High** value only confirms high-risk cmdlets and
Performing operation "Remove File" on Target "C:\temp2.txt".
Remove-Item -Path C:\temp3.txt -Confirm:$false ```
-### \$DebugPreference
+## \$DebugPreference
Determines how PowerShell responds to debugging messages generated by a script, cmdlet or provider, or by a `Write-Debug` command at the command line.
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The debug message isn't displayed and execution continues without interruption.
-#### Examples
+### Examples
The following examples show the effect of changing the values of `$DebugPreference` when a `Write-Debug` command is entered at the command line.
processing continues.
Write-Debug -Message "Hello, World" -Debug:$false ```
-### \$ErrorActionPreference
+## \$ErrorActionPreference
Determines how PowerShell responds to a non-terminating error, an error that doesn't stop the cmdlet processing. For example, at the command line or in a
PowerShell responds to terminating errors that stop cmdlet processing. For more
information about the **ErrorAction** common parameter, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of the `$ErrorActionPreference` variable. The **ErrorAction** parameter is used to
At line:1 char:1
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException ```
-### \$ErrorView
+## \$ErrorView
Determines the display format of error messages in PowerShell.
For more information about the fields in **CategoryView**, see
[ErrorCategoryInfo](/dotnet/api/system.management.automation.errorcategoryinfo) class.
-#### Examples
+### Examples
This example shows how an error appears when the value of `$ErrorView` is the default, **NormalView**. `Get-ChildItem` is used to find a non-existent file.
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1} ```
-### \$FormatEnumerationLimit
+## \$FormatEnumerationLimit
Determines how many enumerated items are included in a display. This variable doesn't affect the underlying objects, only the display. When the value of
PowerShell adds an ellipsis (`...`) to indicate items not shown.
**Default value**: 4
-#### Examples
+### Examples
This example shows how to use the `$FormatEnumerationLimit` variable to improve the display of enumerated items.
Count Name Group
WmdmPmSN, Wmi, WmiApSrv, xmlprov} ```
-### \$InformationPreference
+## \$InformationPreference
The `$InformationPreference` variable lets you set information stream preferences that you want displayed to users. Specifically, informational
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The informational messages aren't displayed, and the script continues without interruption.
-### \$Log*Event
+## \$Log*Event
The **Log*Event** preference variables determine which types of events are written to the PowerShell event log in Event Viewer. By default, only engine
console. To apply the configuration to all consoles, save the variable settings
in your PowerShell profile. For more information, see [about_Profiles](about_Profiles.md).
-### \$MaximumAliasCount
+## \$MaximumAliasCount
Determines how many aliases are permitted in a PowerShell session. The default value is **4096** and that should be enough for most uses. You can adjust
To count the aliases on your system, type:
(Get-Alias).count ```
-### \$MaximumDriveCount
+## \$MaximumDriveCount
Determines how many PowerShell drives are permitted in a given session. For example, file system drives and data stores that are exposed by PowerShell
To count the aliases on your system, type:
(Get-PSDrive).count ```
-### \$MaximumErrorCount
+## \$MaximumErrorCount
Determines how many errors are saved in the error history for the session.
the properties and methods of the objects in the collection.
$Error | Get-Member ```
-### \$MaximumFunctionCount
+## \$MaximumFunctionCount
Determines how many functions are permitted in a given session.
To count the functions in the current session, type:
(Get-ChildItem Function:).Count ```
-### \$MaximumHistoryCount
+## \$MaximumHistoryCount
Determines how many commands are saved in the command history for the current session.
To determine the number of commands current saved in the command history, type:
To see the commands saved in your session history, use the `Get-History` cmdlet. For more information, see [about_History](about_History.md).
-### \$MaximumVariableCount
+## \$MaximumVariableCount
Determines how many variables are permitted in a given session, including automatic variables, preference variables, and the variables that you create in
To find the current number of variables on the system, type:
(Get-Variable).Count ```
-### \$OFS
+## \$OFS
The Output Field Separator (OFS) specifies the character that separates the elements of an array that is converted to a string.
the value of `$OFS` in your session, by typing `$OFS="<value>"`.
> module, or configuration output, be careful that the `$OFS` default value > hasn't been changed elsewhere in your code.
-#### Examples
+### Examples
This example shows that a space is used to separate the values when an array is converted to a string. In this case, an array of integers is stored in a
Remove-Variable OFS
1 2 3 4 ```
-### \$OutputEncoding
+## \$OutputEncoding
Determines the character encoding method that PowerShell uses when it sends text to other applications.
as [**ASCIIEncoding**](/dotnet/api/system.text.asciiencoding),
**Default**: [ASCIIEncoding](/dotnet/api/system.text.asciiencoding) object.
-#### Examples
+### Examples
This example shows how to make the Windows **findstr.exe** command work in PowerShell on a computer that is localized for a language that uses Unicode
findstr <Unicode-characters>
test.txt: <Unicode-characters> ```
-### \$ProgressPreference
+## \$ProgressPreference
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the
The valid values are as follows:
- **SilentlyContinue**: Executes the command, but doesn't display the progress bar.
-### \$PSDefaultParameterValues
+## \$PSDefaultParameterValues
Specifies default values for the parameters of cmdlets and advanced functions. The value of `$PSDefaultParameterValues` is a hash table where the key consists
a custom default value that you specify.
For more information about this preference variable, see [about_Parameters_Default_Values](about_Parameters_Default_Values.md).
-### \$PSEmailServer
+## \$PSEmailServer
Specifies the default e-mail server that is used to send email messages. This preference variable is used by cmdlets that send email, such as the [Send-MailMessage](xref:Microsoft.PowerShell.Utility.Send-MailMessage) cmdlet.
-### \$PSModuleAutoloadingPreference
+## \$PSModuleAutoloadingPreference
Enables and disables automatic importing of modules in the session. **All** is the default. Regardless of the variable's value, you can use
Valid values are:
For more information about automatic importing of modules, see [about_Modules](about_Modules.md).
-### \$PSSessionApplicationName
+## \$PSSessionApplicationName
Specifies the default application name for a remote command that uses Web Services for Management (WS-Management) technology. For more information, see
computer, but it specifies a listener on the remote computer. If the
application name that you specify doesn't exist on the remote computer, the command to establish the session fails.
-### \$PSSessionConfigurationName
+## \$PSSessionConfigurationName
Specifies the default session configuration that is used for **PSSessions** created in the current session.
are used when remote users create a session that connects to this computer.
However, you can use the permissions for the local session configurations to determine which users may use them.
-### \$PSSessionOption
+## \$PSSessionOption
Establishes the default values for advanced user options in a remote session. These option preferences override the system default values for session
To set custom session options, use the `New-PSSessionOption` cmdlet to create a
value of the **SessionOption** parameter in cmdlets that create a session, such as `New-PSSession`, `Enter-PSSession`, and `Invoke-Command`.
-### $Transcript
+## $Transcript
Used by `Start-Transcript` to specify the name and location of the transcript file. If you do not specify a value for the **Path** parameter,
variable. If you have not created this variable, `Start-Transcript` stores the
transcripts in the `$Home\My Documents` directory as `\PowerShell_transcript.<time-stamp>.txt` files.
-### \$VerbosePreference
+## \$VerbosePreference
Determines how PowerShell responds to verbose messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **Verbose** common parameter of a cmdlet to display or hide the
verbose messages for a specific command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$VerbosePreference` and the **Verbose** parameter to override the preference value.
displayed.
Write-Verbose -Message "Verbose message test." -Verbose:$false ```
-### \$WarningPreference
+## \$WarningPreference
Determines how PowerShell responds to warning messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **WarningAction** common parameter of a cmdlet to determine how
PowerShell responds to warnings from a particular command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$WarningPreference`. The **WarningAction** parameter overrides the preference value.
Continue with this operation?
[?] Help (default is "Y"): ```
-### \$WhatIfPreference
+## \$WhatIfPreference
Determines whether **WhatIf** is automatically enabled for every command that supports it. When **WhatIf** is enabled, the cmdlet reports the expected effect
The valid values are as follows:
that supports it. Users can use the **WhatIf** parameter with a value of **False** to disable it manually, such as `-WhatIf:$false`.
-#### Examples
+### Examples
These examples show the effect of the different values of `$WhatIfPreference`. They show how to use the **WhatIf** parameter to override the preference value
Microsoft.PowerShell.Core About Preference Variables (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Preference_Variables.md
--- description: Variables that customize the behavior of PowerShell. Locale: en-US Previously updated : 07/17/2021 Last updated : 02/09/2022 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Preference Variables
messages.
For more information about remote commands, see [about_Remote](about_Remote.md).
-### \$ConfirmPreference
+## \$ConfirmPreference
Determines whether PowerShell automatically prompts you for confirmation before running a cmdlet or function.
Valid values of `$ConfirmPreference`:
- **High**: PowerShell prompts for confirmation before running cmdlets or functions with a high risk.
-#### Detailed explanation
+### Detailed explanation
PowerShell can automatically prompt you for confirmation before doing an action. For example, when cmdlet or function significantly affects the system
is **High**, automatic confirmation rarely occurs. However, you can activate
automatic confirmation by changing the value of `$ConfirmPreference` to **Medium** or **Low**.
-#### Examples
+### Examples
This example shows the effect of the `$ConfirmPreference` variable's default value, **High**. The **High** value only confirms high-risk cmdlets and
Performing operation "Remove File" on Target "C:\temp2.txt".
Remove-Item -Path C:\temp3.txt -Confirm:$false ```
-### \$DebugPreference
+## \$DebugPreference
Determines how PowerShell responds to debugging messages generated by a script, cmdlet or provider, or by a `Write-Debug` command at the command line.
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The debug message isn't displayed and execution continues without interruption.
-#### Examples
+### Examples
The following examples show the effect of changing the values of `$DebugPreference` when a `Write-Debug` command is entered at the command line.
processing continues.
Write-Debug -Message "Hello, World" -Debug:$false ```
-### \$ErrorActionPreference
+## \$ErrorActionPreference
Determines how PowerShell responds to a non-terminating error, an error that doesn't stop the cmdlet processing. For example, at the command line or in a
PowerShell responds to terminating errors that stop cmdlet processing. For more
information about the **ErrorAction** common parameter, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of the `$ErrorActionPreference` variable. The **ErrorAction** parameter is used to
HResult : -2146233087
Write-Error: Test Error ```
-### \$ErrorView
+## \$ErrorView
Determines the display format of error messages in PowerShell.
For more information about the fields in **CategoryView**, see
[ErrorCategoryInfo](/dotnet/api/system.management.automation.errorcategoryinfo) class.
-#### Examples
+### Examples
This example shows how an error appears when the value of `$ErrorView` is the default, **ConciseView**. `Get-ChildItem` is used to find a non-existent
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1} ```
-### \$FormatEnumerationLimit
+## \$FormatEnumerationLimit
Determines how many enumerated items are included in a display. This variable doesn't affect the underlying objects, only the display. When the value of
PowerShell adds an ellipsis (`...`) to indicate items not shown.
**Default value**: 4
-#### Examples
+### Examples
This example shows how to use the `$FormatEnumerationLimit` variable to improve the display of enumerated items.
Count Name Group
WmdmPmSN, Wmi, WmiApSrv, xmlprov} ```
-### \$InformationPreference
+## \$InformationPreference
The `$InformationPreference` variable lets you set information stream preferences that you want displayed to users. Specifically, informational
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The informational messages aren't displayed, and the script continues without interruption.
-### \$Log*Event
+## \$Log*Event
The **Log*Event** preference variables determine which types of events are written to the PowerShell event log in Event Viewer. By default, only engine
console. To apply the configuration to all consoles, save the variable settings
in your PowerShell profile. For more information, see [about_Profiles](about_Profiles.md).
-### \$MaximumHistoryCount
+## \$MaximumHistoryCount
Determines how many commands are saved in the command history for the current session.
To determine the number of commands current saved in the command history, type:
To see the commands saved in your session history, use the `Get-History` cmdlet. For more information, see [about_History](about_History.md).
-### \$OFS
+## \$OFS
The Output Field Separator (OFS) specifies the character that separates the elements of an array that is converted to a string.
the value of `$OFS` in your session, by typing `$OFS="<value>"`.
> module, or configuration output, be careful that the `$OFS` default value > hasn't been changed elsewhere in your code.
-#### Examples
+### Examples
This example shows that a space is used to separate the values when an array is converted to a string. In this case, an array of integers is stored in a
Remove-Variable OFS
1 2 3 4 ```
-### \$OutputEncoding
+## \$OutputEncoding
Determines the character encoding method that PowerShell uses when it sends text to other applications.
as [**ASCIIEncoding**](/dotnet/api/system.text.asciiencoding),
**Default**: [UTF8Encoding](/dotnet/api/system.text.utf8encoding) object.
-#### Examples
+### Examples
This example shows how to make the Windows **findstr.exe** command work in PowerShell on a computer that is localized for a language that uses Unicode
findstr <Unicode-characters>
test.txt: <Unicode-characters> ```
-### \$ProgressPreference
+## \$ProgressPreference
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the
The valid values are as follows:
- **SilentlyContinue**: Executes the command, but doesn't display the progress bar.
-### \$PSDefaultParameterValues
+## \$PSDefaultParameterValues
Specifies default values for the parameters of cmdlets and advanced functions. The value of `$PSDefaultParameterValues` is a hash table where the key consists
a custom default value that you specify.
For more information about this preference variable, see [about_Parameters_Default_Values](about_Parameters_Default_Values.md).
-### \$PSEmailServer
+## \$PSEmailServer
Specifies the default e-mail server that is used to send email messages. This preference variable is used by cmdlets that send email, such as the [Send-MailMessage](xref:Microsoft.PowerShell.Utility.Send-MailMessage) cmdlet.
-### \$PSModuleAutoloadingPreference
+## \$PSModuleAutoloadingPreference
Enables and disables automatic importing of modules in the session. **All** is the default. Regardless of the variable's value, you can use
Valid values are:
For more information about automatic importing of modules, see [about_Modules](about_Modules.md).
-### \$PSSessionApplicationName
+## \$PSSessionApplicationName
Specifies the default application name for a remote command that uses Web Services for Management (WS-Management) technology. For more information, see
computer, but it specifies a listener on the remote computer. If the
application name that you specify doesn't exist on the remote computer, the command to establish the session fails.
-### \$PSSessionConfigurationName
+## \$PSSessionConfigurationName
Specifies the default session configuration that is used for **PSSessions** created in the current session.
are used when remote users create a session that connects to this computer.
However, you can use the permissions for the local session configurations to determine which users may use them.
-### \$PSSessionOption
+## \$PSSessionOption
Establishes the default values for advanced user options in a remote session. These option preferences override the system default values for session
To set custom session options, use the `New-PSSessionOption` cmdlet to create a
value of the **SessionOption** parameter in cmdlets that create a session, such as `New-PSSession`, `Enter-PSSession`, and `Invoke-Command`.
-### $Transcript
+## $Transcript
Used by `Start-Transcript` to specify the name and location of the transcript file. If you do not specify a value for the **Path** parameter,
variable. If you have not created this variable, `Start-Transcript` stores the
transcripts in the `$Home\My Documents` directory as `\PowerShell_transcript.<time-stamp>.txt` files.
-### \$VerbosePreference
+## \$VerbosePreference
Determines how PowerShell responds to verbose messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **Verbose** common parameter of a cmdlet to display or hide the
verbose messages for a specific command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$VerbosePreference` and the **Verbose** parameter to override the preference value.
displayed.
Write-Verbose -Message "Verbose message test." -Verbose:$false ```
-### \$WarningPreference
+## \$WarningPreference
Determines how PowerShell responds to warning messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **WarningAction** common parameter of a cmdlet to determine how
PowerShell responds to warnings from a particular command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$WarningPreference`. The **WarningAction** parameter overrides the preference value.
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is "Y"): ```
-### \$WhatIfPreference
+## \$WhatIfPreference
Determines whether **WhatIf** is automatically enabled for every command that supports it. When **WhatIf** is enabled, the cmdlet reports the expected effect
The valid values are as follows:
that supports it. Users can use the **WhatIf** parameter with a value of **False** to disable it manually, such as `-WhatIf:$false`.
-#### Examples
+### Examples
These examples show the effect of the different values of `$WhatIfPreference`. They show how to use the **WhatIf** parameter to override the preference value
Microsoft.PowerShell.Core About Preference Variables (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Preference_Variables.md
--- description: Variables that customize the behavior of PowerShell. Locale: en-US Previously updated : 07/17/2021 Last updated : 02/09/2022 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Preference Variables
Microsoft.PowerShell.Core About Preference Variables (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Preference_Variables.md
--- description: Variables that customize the behavior of PowerShell. Locale: en-US Previously updated : 07/17/2021 Last updated : 02/09/2022 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Preference Variables
messages.
For more information about remote commands, see [about_Remote](about_Remote.md).
-### \$ConfirmPreference
+## \$ConfirmPreference
Determines whether PowerShell automatically prompts you for confirmation before running a cmdlet or function.
Valid values of `$ConfirmPreference`:
- **High**: PowerShell prompts for confirmation before running cmdlets or functions with a high risk.
-#### Detailed explanation
+### Detailed explanation
PowerShell can automatically prompt you for confirmation before doing an action. For example, when cmdlet or function significantly affects the system
is **High**, automatic confirmation rarely occurs. However, you can activate
automatic confirmation by changing the value of `$ConfirmPreference` to **Medium** or **Low**.
-#### Examples
+### Examples
This example shows the effect of the `$ConfirmPreference` variable's default value, **High**. The **High** value only confirms high-risk cmdlets and
Performing operation "Remove File" on Target "C:\temp2.txt".
Remove-Item -Path C:\temp3.txt -Confirm:$false ```
-### \$DebugPreference
+## \$DebugPreference
Determines how PowerShell responds to debugging messages generated by a script, cmdlet or provider, or by a `Write-Debug` command at the command line.
The `$DebugPreference` variable takes one of the
[`ActionPreference`](/dotnet/api/system.management.automation.actionpreference) enumeration values: **SilentlyContinue**, **Stop**, **Continue**, **Inquire**, **Ignore**, **Suspend**, or **Break**.+ Some cmdlets display debugging messages, which are typically technical messages designed for programmers and technical support professionals. By default, debugging messages aren't displayed, but you can display debugging messages by
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The debug message isn't displayed and execution continues without interruption.
-#### Examples
+### Examples
The following examples show the effect of changing the values of `$DebugPreference` when a `Write-Debug` command is entered at the command line.
processing continues.
Write-Debug -Message "Hello, World" -Debug:$false ```
-### \$ErrorActionPreference
+## \$ErrorActionPreference
Determines how PowerShell responds to a non-terminating error, an error that doesn't stop the cmdlet processing. For example, at the command line or in a
PowerShell responds to terminating errors that stop cmdlet processing. For more
information about the **ErrorAction** common parameter, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of the `$ErrorActionPreference` variable. The **ErrorAction** parameter is used to
HResult : -2146233087
Write-Error: Test Error ```
-### \$ErrorView
+## \$ErrorView
Determines the display format of error messages in PowerShell.
For more information about the fields in **CategoryView**, see
[ErrorCategoryInfo](/dotnet/api/system.management.automation.errorcategoryinfo) class.
-#### Examples
+### Examples
This example shows how an error appears when the value of `$ErrorView` is the default, **ConciseView**. `Get-ChildItem` is used to find a non-existent
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1} ```
-### \$FormatEnumerationLimit
+## \$FormatEnumerationLimit
Determines how many enumerated items are included in a display. This variable doesn't affect the underlying objects, only the display. When the value of
PowerShell adds an ellipsis (`...`) to indicate items not shown.
**Default value**: 4
-#### Examples
+### Examples
This example shows how to use the `$FormatEnumerationLimit` variable to improve the display of enumerated items.
Count Name Group
WmdmPmSN, Wmi, WmiApSrv, xmlprov} ```
-### \$InformationPreference
+## \$InformationPreference
The `$InformationPreference` variable lets you set information stream preferences that you want displayed to users. Specifically, informational
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The informational messages aren't displayed, and the script continues without interruption.
-### \$Log*Event
+## \$Log*Event
The **Log*Event** preference variables determine which types of events are written to the PowerShell event log in Event Viewer. By default, only engine
console. To apply the configuration to all consoles, save the variable settings
in your PowerShell profile. For more information, see [about_Profiles](about_Profiles.md).
-### \$MaximumHistoryCount
+## \$MaximumHistoryCount
Determines how many commands are saved in the command history for the current session.
To determine the number of commands current saved in the command history, type:
To see the commands saved in your session history, use the `Get-History` cmdlet. For more information, see [about_History](about_History.md).
-### \$OFS
+## \$OFS
The Output Field Separator (OFS) specifies the character that separates the elements of an array that is converted to a string.
the value of `$OFS` in your session, by typing `$OFS="<value>"`.
> module, or configuration output, be careful that the `$OFS` default value > hasn't been changed elsewhere in your code.
-#### Examples
+### Examples
This example shows that a space is used to separate the values when an array is converted to a string. In this case, an array of integers is stored in a
Remove-Variable OFS
1 2 3 4 ```
-### \$OutputEncoding
+## \$OutputEncoding
Determines the character encoding method that PowerShell uses when it sends text to other applications.
as [**ASCIIEncoding**](/dotnet/api/system.text.asciiencoding),
**Default**: [UTF8Encoding](/dotnet/api/system.text.utf8encoding) object.
-#### Examples
+### Examples
This example shows how to make the Windows **findstr.exe** command work in PowerShell on a computer that is localized for a language that uses Unicode
findstr <Unicode-characters>
test.txt: <Unicode-characters> ```
-### \$ProgressPreference
+## \$ProgressPreference
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the
The valid values are as follows:
- **SilentlyContinue**: Executes the command, but doesn't display the progress bar.
-### \$PSDefaultParameterValues
+## \$PSDefaultParameterValues
Specifies default values for the parameters of cmdlets and advanced functions. The value of `$PSDefaultParameterValues` is a hash table where the key consists
a custom default value that you specify.
For more information about this preference variable, see [about_Parameters_Default_Values](about_Parameters_Default_Values.md).
-### \$PSEmailServer
+## \$PSEmailServer
Specifies the default e-mail server that is used to send email messages. This preference variable is used by cmdlets that send email, such as the [Send-MailMessage](xref:Microsoft.PowerShell.Utility.Send-MailMessage) cmdlet.
-### \$PSModuleAutoloadingPreference
+## \$PSModuleAutoloadingPreference
Enables and disables automatic importing of modules in the session. **All** is the default. Regardless of the variable's value, you can use
Valid values are:
For more information about automatic importing of modules, see [about_Modules](about_Modules.md).
-### \$PSSessionApplicationName
+## \$PSSessionApplicationName
Specifies the default application name for a remote command that uses Web Services for Management (WS-Management) technology. For more information, see
computer, but it specifies a listener on the remote computer. If the
application name that you specify doesn't exist on the remote computer, the command to establish the session fails.
-### \$PSSessionConfigurationName
+## \$PSSessionConfigurationName
Specifies the default session configuration that is used for **PSSessions** created in the current session.
are used when remote users create a session that connects to this computer.
However, you can use the permissions for the local session configurations to determine which users may use them.
-### \$PSSessionOption
+## \$PSSessionOption
Establishes the default values for advanced user options in a remote session. These option preferences override the system default values for session
To set custom session options, use the `New-PSSessionOption` cmdlet to create a
value of the **SessionOption** parameter in cmdlets that create a session, such as `New-PSSession`, `Enter-PSSession`, and `Invoke-Command`.
-### $Transcript
+## $Transcript
Used by `Start-Transcript` to specify the name and location of the transcript file. If you do not specify a value for the **Path** parameter,
variable. If you have not created this variable, `Start-Transcript` stores the
transcripts in the `$Home\My Documents` directory as `\PowerShell_transcript.<time-stamp>.txt` files.
-### \$VerbosePreference
+## \$VerbosePreference
Determines how PowerShell responds to verbose messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **Verbose** common parameter of a cmdlet to display or hide the
verbose messages for a specific command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$VerbosePreference` and the **Verbose** parameter to override the preference value.
displayed.
Write-Verbose -Message "Verbose message test." -Verbose:$false ```
-### \$WarningPreference
+## \$WarningPreference
Determines how PowerShell responds to warning messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **WarningAction** common parameter of a cmdlet to determine how
PowerShell responds to warnings from a particular command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$WarningPreference`. The **WarningAction** parameter overrides the preference value.
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is "Y"): ```
-### \$WhatIfPreference
+## \$WhatIfPreference
Determines whether **WhatIf** is automatically enabled for every command that supports it. When **WhatIf** is enabled, the cmdlet reports the expected effect
The valid values are as follows:
that supports it. Users can use the **WhatIf** parameter with a value of **False** to disable it manually, such as `-WhatIf:$false`.
-#### Examples
+### Examples
These examples show the effect of the different values of `$WhatIfPreference`. They show how to use the **WhatIf** parameter to override the preference value
Microsoft.PowerShell.Core About Preference Variables (7.3) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.3/Microsoft.PowerShell.Core/About/about_Preference_Variables.md
--- description: Variables that customize the behavior of PowerShell. Locale: en-US Previously updated : 07/17/2021 Last updated : 02/09/2022 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Preference Variables
messages.
For more information about remote commands, see [about_Remote](about_Remote.md).
-### \$ConfirmPreference
+## \$ConfirmPreference
Determines whether PowerShell automatically prompts you for confirmation before running a cmdlet or function.
Valid values of `$ConfirmPreference`:
- **High**: PowerShell prompts for confirmation before running cmdlets or functions with a high risk.
-#### Detailed explanation
+### Detailed explanation
PowerShell can automatically prompt you for confirmation before doing an action. For example, when cmdlet or function significantly affects the system
is **High**, automatic confirmation rarely occurs. However, you can activate
automatic confirmation by changing the value of `$ConfirmPreference` to **Medium** or **Low**.
-#### Examples
+### Examples
This example shows the effect of the `$ConfirmPreference` variable's default value, **High**. The **High** value only confirms high-risk cmdlets and
Performing operation "Remove File" on Target "C:\temp2.txt".
Remove-Item -Path C:\temp3.txt -Confirm:$false ```
-### \$DebugPreference
+## \$DebugPreference
Determines how PowerShell responds to debugging messages generated by a script, cmdlet or provider, or by a `Write-Debug` command at the command line.
The `$DebugPreference` variable takes one of the
[`ActionPreference`](/dotnet/api/system.management.automation.actionpreference) enumeration values: **SilentlyContinue**, **Stop**, **Continue**, **Inquire**, **Ignore**, **Suspend**, or **Break**.+ Some cmdlets display debugging messages, which are typically technical messages designed for programmers and technical support professionals. By default, debugging messages aren't displayed, but you can display debugging messages by
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The debug message isn't displayed and execution continues without interruption.
-#### Examples
+### Examples
The following examples show the effect of changing the values of `$DebugPreference` when a `Write-Debug` command is entered at the command line.
processing continues.
Write-Debug -Message "Hello, World" -Debug:$false ```
-### \$ErrorActionPreference
+## \$ErrorActionPreference
Determines how PowerShell responds to a non-terminating error, an error that doesn't stop the cmdlet processing. For example, at the command line or in a
PowerShell responds to terminating errors that stop cmdlet processing. For more
information about the **ErrorAction** common parameter, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of the `$ErrorActionPreference` variable. The **ErrorAction** parameter is used to
HResult : -2146233087
Write-Error: Test Error ```
-### \$ErrorView
+## \$ErrorView
Determines the display format of error messages in PowerShell.
For more information about the fields in **CategoryView**, see
[ErrorCategoryInfo](/dotnet/api/system.management.automation.errorcategoryinfo) class.
-#### Examples
+### Examples
This example shows how an error appears when the value of `$ErrorView` is the default, **ConciseView**. `Get-ChildItem` is used to find a non-existent
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1} ```
-### \$FormatEnumerationLimit
+## \$FormatEnumerationLimit
Determines how many enumerated items are included in a display. This variable doesn't affect the underlying objects, only the display. When the value of
PowerShell adds an ellipsis (`...`) to indicate items not shown.
**Default value**: 4
-#### Examples
+### Examples
This example shows how to use the `$FormatEnumerationLimit` variable to improve the display of enumerated items.
Count Name Group
WmdmPmSN, Wmi, WmiApSrv, xmlprov} ```
-### \$InformationPreference
+## \$InformationPreference
The `$InformationPreference` variable lets you set information stream preferences that you want displayed to users. Specifically, informational
The valid values are as follows:
- **SilentlyContinue**: (Default) No effect. The informational messages aren't displayed, and the script continues without interruption.
-### \$Log*Event
+## \$Log*Event
The **Log*Event** preference variables determine which types of events are written to the PowerShell event log in Event Viewer. By default, only engine
console. To apply the configuration to all consoles, save the variable settings
in your PowerShell profile. For more information, see [about_Profiles](about_Profiles.md).
-### \$MaximumHistoryCount
+## \$MaximumHistoryCount
Determines how many commands are saved in the command history for the current session.
To determine the number of commands current saved in the command history, type:
To see the commands saved in your session history, use the `Get-History` cmdlet. For more information, see [about_History](about_History.md).
-### \$OFS
+## \$OFS
The Output Field Separator (OFS) specifies the character that separates the elements of an array that is converted to a string.
the value of `$OFS` in your session, by typing `$OFS="<value>"`.
> module, or configuration output, be careful that the `$OFS` default value > hasn't been changed elsewhere in your code.
-#### Examples
+### Examples
This example shows that a space is used to separate the values when an array is converted to a string. In this case, an array of integers is stored in a
Remove-Variable OFS
1 2 3 4 ```
-### \$OutputEncoding
+## \$OutputEncoding
Determines the character encoding method that PowerShell uses when it sends text to other applications.
as [**ASCIIEncoding**](/dotnet/api/system.text.asciiencoding),
**Default**: [UTF8Encoding](/dotnet/api/system.text.utf8encoding) object.
-#### Examples
+### Examples
This example shows how to make the Windows **findstr.exe** command work in PowerShell on a computer that is localized for a language that uses Unicode
findstr <Unicode-characters>
test.txt: <Unicode-characters> ```
-### \$ProgressPreference
+## \$ProgressPreference
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the
The valid values are as follows:
- **SilentlyContinue**: Executes the command, but doesn't display the progress bar.
-### \$PSDefaultParameterValues
+## \$PSDefaultParameterValues
Specifies default values for the parameters of cmdlets and advanced functions. The value of `$PSDefaultParameterValues` is a hash table where the key consists
a custom default value that you specify.
For more information about this preference variable, see [about_Parameters_Default_Values](about_Parameters_Default_Values.md).
-### \$PSEmailServer
+## \$PSEmailServer
Specifies the default e-mail server that is used to send email messages. This preference variable is used by cmdlets that send email, such as the [Send-MailMessage](xref:Microsoft.PowerShell.Utility.Send-MailMessage) cmdlet.
-### \$PSModuleAutoloadingPreference
+## \$PSModuleAutoloadingPreference
Enables and disables automatic importing of modules in the session. **All** is the default. Regardless of the variable's value, you can use
Valid values are:
For more information about automatic importing of modules, see [about_Modules](about_Modules.md).
-### \$PSSessionApplicationName
+## \$PSNativeCommandUseErrorActionPreference
+
+This preference variable is only available in PowerShell 7.3 with the
+`PSNativeCommandErrorActionPreference` feature enabled.
+
+With this feature enabled, native commands with non-zero exit codes issue
+errors according to `$ErrorActionPreference` when
+`$PSNativeCommandUseErrorActionPreference` is `$true`.
+
+For more information, see
+[PSNativeCommandErrorActionPreference](/powershell/scripting/learn/experimental-features#psnativecommanderroractionpreference).
+
+## \$PSSessionApplicationName
Specifies the default application name for a remote command that uses Web Services for Management (WS-Management) technology. For more information, see
computer, but it specifies a listener on the remote computer. If the
application name that you specify doesn't exist on the remote computer, the command to establish the session fails.
-### \$PSSessionConfigurationName
+## \$PSSessionConfigurationName
Specifies the default session configuration that is used for **PSSessions** created in the current session.
are used when remote users create a session that connects to this computer.
However, you can use the permissions for the local session configurations to determine which users may use them.
-### \$PSSessionOption
+## \$PSSessionOption
Establishes the default values for advanced user options in a remote session. These option preferences override the system default values for session
To set custom session options, use the `New-PSSessionOption` cmdlet to create a
value of the **SessionOption** parameter in cmdlets that create a session, such as `New-PSSession`, `Enter-PSSession`, and `Invoke-Command`.
-### $Transcript
+## $Transcript
Used by `Start-Transcript` to specify the name and location of the transcript file. If you do not specify a value for the **Path** parameter,
variable. If you have not created this variable, `Start-Transcript` stores the
transcripts in the `$Home\My Documents` directory as `\PowerShell_transcript.<time-stamp>.txt` files.
-### \$VerbosePreference
+## \$VerbosePreference
Determines how PowerShell responds to verbose messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **Verbose** common parameter of a cmdlet to display or hide the
verbose messages for a specific command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$VerbosePreference` and the **Verbose** parameter to override the preference value.
displayed.
Write-Verbose -Message "Verbose message test." -Verbose:$false ```
-### \$WarningPreference
+## \$WarningPreference
Determines how PowerShell responds to warning messages generated by a script, cmdlet, or provider, such as the messages generated by the
You can use the **WarningAction** common parameter of a cmdlet to determine how
PowerShell responds to warnings from a particular command. For more information, see [about_CommonParameters](about_CommonParameters.md).
-#### Examples
+### Examples
These examples show the effect of the different values of `$WarningPreference`. The **WarningAction** parameter overrides the preference value.
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is "Y"): ```
-### \$WhatIfPreference
+## \$WhatIfPreference
Determines whether **WhatIf** is automatically enabled for every command that supports it. When **WhatIf** is enabled, the cmdlet reports the expected effect
The valid values are as follows:
that supports it. Users can use the **WhatIf** parameter with a value of **False** to disable it manually, such as `-WhatIf:$false`.
-#### Examples
+### Examples
These examples show the effect of the different values of `$WhatIfPreference`. They show how to use the **WhatIf** parameter to override the preference value
learn Experimental Features https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/learn/experimental-features.md
--- description: Lists the currently available experimental features and how to use them. Previously updated : 01/19/2022 Last updated : 02/09/2022 Title: Using Experimental Features in PowerShell --- # Using Experimental Features in PowerShell
Legend
| PSNativeCommandArgumentPassing | | | &#x2714;&#xfe0f; | &#x2714;&#xfe0f; | | PSAnsiRenderingFileInfo | | | &#x2714;&#xfe0f; | &#x2714;&#xfe0f; | | PSLoadAssemblyFromNativeCode | | | &#x2714;&#xfe0f; | &#x2714;&#xfe0f; |
-| PSExec | | | | &#x2714;&#xfe0f; |
| PSCleanBlock | | | | &#x2714;&#xfe0f; |
+| PSExec | | | | &#x2714;&#xfe0f; |
+| PSNativeCommandErrorActionPreference | | | | &#x2714;&#xfe0f; |
| PSStrictModeAssignment | | | | &#x2714;&#xfe0f; | ## Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace
Arg 1 is <a" "b>
Arg 2 is <a b> ```
+## PSNativeCommandErrorActionPreference
+
+Native commands usually return an exit code to the calling application that is zero for success or
+non-zero for failure. However, native commands currently do not participate in the PowerShell error
+stream. Redirected **stderr** output is not interpreted the same as the PowerShell error stream.
+Many native commands use stderr as an information or verbose stream, thus only the exit code
+matters. Users working with native commands in their scripts need to check the exit status after
+each call using similar to the following example:
+
+```powershell
+if ($LASTEXITCODE -ne 0) {
+ throw "Command failed. See above errors for details"
+}
+```
+
+Simply relaying the errors through the error stream isn't the solution. The example itself doesn't
+support all cases where `$?` can be false from a cmdlet or function error, making `$LASTEXITCODE`
+stale.
+
+This feature implements a preference variable to enable errors produced by native commands to be
+PowerShell errors. This allows native command failures to produce error objects that are added to
+the PowerShell error stream that may terminate execution of the script without extra handling.
+
+With this feature enabled, native commands with non-zero exit codes issue errors according to
+`$ErrorActionPreference` when `$PSNativeCommandUseErrorActionPreference` is `$true`.
+ ## PSNativePSPathResolution If a PSDrive path that uses the FileSystem provider is passed to a native command, the resolved file
whats-new What S New In Powershell 73 https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md
--- Title: What's New in PowerShell 7.3-preview.1 description: New features and changes released in PowerShell 7.3-preview.1 Previously updated : 01/19/2022 Last updated : 02/09/2022 --- # What's New in PowerShell 7.3
PowerShell 7.3 is the next preview release, built on .NET 6.0.
PowerShell 7.3-preview.1 includes the following features, updates, and breaking changes. - Set `$?` correctly for command expression with redirections (#16046)-- Fix a casting error when using `$PSNativeCommandUsesErrorActionPreference` (#15993)
+- Fix a casting error when using `$PSNativeCommandUseErrorActionPreference` (#15993)
- Make the native command error handling optionally honor `ErrorActionPreference` (#15897) - Fix tab completion within the script block specified for the `ValidateScriptAttribute`. (#14550) (Thanks @MartinGC94!)
For a complete list of changes, see the [Change Log][CHANGELOG] in the GitHub re
PowerShell 7.3 introduces the following experimental features: -- [PSExec][psexec] - Adds the new `Switch-Process` cmdlet (alias `exec`) to provide `exec`
+- [PSExec][exp-psexec] - Adds the new `Switch-Process` cmdlet (alias `exec`) to provide `exec`
compatibility for non-Windows systems. - [PSCleanBlock][exp-clean] - Adds `clean` block to script block as a peer to `begin`, `process`,
- and `end` to allow easy resource cleanup
-- [PSStrictModeAssignment][strict] - Adds the **StrictMode** parameter to `Invoke-Command` to allow
- specifying strict mode when invoking command locally.
+ and `end` to allow easy resource cleanup.
+- [PSStrictModeAssignment][exp-strict] - Adds the **StrictMode** parameter to `Invoke-Command` to
+ allow specifying strict mode when invoking command locally.
+- [PSNativeCommandErrorActionPreference][exp-error] - Adds the
+ `$PSNativeCommandUseErrorActionPreference` variable to enable errors produced by native commands
+ to be PowerShell errors.
For more information about the Experimental Features, see [Using Experimental Features][exp].
For more information about the Experimental Features, see [Using Experimental Fe
[CHANGELOG]: https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0-preview.1 [exp-clean]: ../learn/experimental-features.md#pscleanblock
-[psexec]: ../learn/experimental-features.md#psexec
-[strict]: ../learn/experimental-features.md#psstrictmodeassignment
+[exp-psexec]: ../learn/experimental-features.md#psexec
+[exp-strict]: ../learn/experimental-features.md#psstrictmodeassignment
+[exp-error]: ../learn/experimental-features.md#psnativecommanderroractionpreference
module Index https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/module/index.md
ms.
ms.product: powershell quickFilterColumn1: powershell-7.1,windowsserver2019-ps
-quickFilterColumn2: azps-7.1.0,win-mdop2-ps
+quickFilterColumn2: azps-7.2.0,win-mdop2-ps
quickFilterColumn3: sqlserver-ps,systemcenter-ps-2019 Title: PowerShell Module Browser ---