Skip to content
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

6/08/2023 3PM Publishing #10158

Merged
merged 4 commits into from
Jun 8, 2023
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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion reference/5.1/Microsoft.PowerShell.Utility/Get-Random.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Get-Random -Minimum -100 -Maximum 100

### Example 4: Get a random floating-point number

This command gets a random floating-point number greater than or equal to 10.7 and less than 20.92.
This command gets a random floating-point number greater than or equal to 10.7 and less than 20.93.

```powershell
Get-Random -Minimum 10.7 -Maximum 20.93
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion reference/7.2/Microsoft.PowerShell.Utility/Get-Random.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Get-Random -Minimum -100 -Maximum 100

### Example 4: Get a random floating-point number

This command gets a random floating-point number greater than or equal to 10.7 and less than 20.92.
This command gets a random floating-point number greater than or equal to 10.7 and less than 20.93.

```powershell
Get-Random -Minimum 10.7 -Maximum 20.93
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,8 @@ Accept wildcard characters: False
### -MaximumRetryCount

Specifies how many times PowerShell retries a connection when a failure code between 400 and 599,
inclusive or 304 is received. Also see **RetryIntervalSec** parameter for specifying number of
retries.
inclusive or 304 is received. Also, see the **RetryIntervalSec** parameter for specifying the number
of seconds between retries.

```yaml
Type: System.Int32
Expand Down Expand Up @@ -945,8 +945,9 @@ Accept wildcard characters: False
### -RetryIntervalSec

Specifies the interval between retries for the connection when a failure code between 400 and 599,
inclusive or 304 is received. Also see **MaximumRetryCount** parameter for specifying number of
retries. The value must be between `1` and `[int]::MaxValue`.
inclusive or 304 is received. The value must be between `1` and `[int]::MaxValue`.

Also, see the **MaximumRetryCount** parameter for specifying number of retries.

```yaml
Type: System.Int32
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the parameters that can be used with any cmdlet.
Locale: en-US
ms.date: 01/21/2022
ms.date: 03/14/2023
no-loc: [Debug, Verbose, Confirm]
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.3&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand All @@ -27,10 +27,10 @@ The common parameters are also available on advanced functions that use the
**CmdletBinding** attribute or the **Parameter** attribute.

Several common parameters override system defaults or preferences that you set
by using the PowerShell preference variables. Unlike the preference variables,
the common parameters affect only the commands in which they're used.
using the PowerShell preference variables. Unlike the preference variables, the
common parameters affect only the commands in which they're used.

For more information, see [about_Preference_Variables](./about_Preference_Variables.md).
For more information, see [about_Preference_Variables][03].

The following list displays the common parameters. Their aliases are listed in
parentheses.
Expand Down Expand Up @@ -77,8 +77,7 @@ The risk mitigation parameters are:

Displays programmer-level detail about the operation done by the command. This
parameter works only when the command generates a debugging message. For
example, this parameter works when a command contains the `Write-Debug`
cmdlet.
example, this parameter works when a command contains the `Write-Debug` cmdlet.

```yaml
Type: SwitchParameter
Expand Down Expand Up @@ -124,10 +123,11 @@ Accept pipeline input: False
Accept wildcard characters: False
```

The **ErrorAction** parameter overrides the value of the `$ErrorActionPreference`
variable for the current command. Because the default value of the
`$ErrorActionPreference` variable is **Continue**, error messages are displayed
and execution continues unless you use the **ErrorAction** parameter.
The **ErrorAction** parameter overrides the value of the
`$ErrorActionPreference` variable for the current command. Because the default
value of the `$ErrorActionPreference` variable is **Continue**, error messages
are displayed and execution continues unless you use the **ErrorAction**
parameter.

The **ErrorAction** parameter has no effect on terminating errors (such as
missing data, parameters that aren't valid, or insufficient permissions) that
Expand Down Expand Up @@ -156,15 +156,15 @@ executing the command.
in PowerShell 6 and beyond.

> [!NOTE]
> The **ErrorAction** parameter overrides, but does not replace the value of
> the `$ErrorActionPreference` variable when the parameter is used in a
> command to run a script or function.
> The **ErrorAction** parameter overrides, but doesn't replace the value of the
> `$ErrorActionPreference` variable when the parameter is used in a command to
> run a script or function.

### -ErrorVariable

**ErrorVariable** stores error messages about the command in the specified
variable and in the `$Error` automatic variable. For more information, see
[about_Automatic_Variables](about_Automatic_Variables.md)
[about_Automatic_Variables][02]

```yaml
Type: String
Expand Down Expand Up @@ -201,11 +201,10 @@ $a
```

You can use this parameter to create a variable that contains only error
messages from specific commands and does not affect the behavior of the
`$Error` automatic variable. The `$Error` automatic variable contains error
messages from all the commands in the session. You can use array notation, such
as `$a[0]` or `$error[1,2]` to refer to specific errors stored in the
variables.
messages from specific commands and doesn't affect the behavior of the `$Error`
automatic variable. The `$Error` automatic variable contains error messages
from all the commands in the session. You can use array notation, such as
`$a[0]` or `$error[1,2]` to refer to specific errors stored in the variables.

> [!NOTE]
> The custom error variable contains all errors generated by the command,
Expand All @@ -219,11 +218,11 @@ the **InformationAction** common parameter overrides the value of the
**SilentlyContinue**. When you use `Write-Information` in a script with
**InformationAction**, `Write-Information` values are shown depending on the
value of the **InformationAction** parameter. For more information about
`$InformationPreference`, see [about_Preference_Variables](./about_Preference_Variables.md).
`$InformationPreference`, see [about_Preference_Variables][03].

```yaml
Type: ActionPreference
Aliases: ia
Aliases: infa
Accepted values: Break, Suspend, Ignore, Inquire, Continue, Stop, SilentlyContinue

Required: False
Expand Down Expand Up @@ -257,7 +256,7 @@ is only available for workflows.
aren't (Default) displayed, and the script continues without interruption.

> [!NOTE]
> The **InformationAction** parameter overrides, but does not replace the
> The **InformationAction** parameter overrides, but doesn't replace the
> value of the `$InformationAction` preference variable when the parameter
> is used in a command to run a script or function.

Expand All @@ -270,7 +269,7 @@ values are shown depending on the value of the **InformationAction** common
parameter; if you don't add the **InformationAction** common parameter,
`Write-Information` strings are shown depending on the value of the
`$InformationPreference` preference variable. For more information about
`$InformationPreference`, see [about_Preference_Variables](./about_Preference_Variables.md).
`$InformationPreference`, see [about_Preference_Variables][03].

> [!NOTE]
> The information variable contains all information messages generated by the
Expand Down Expand Up @@ -378,7 +377,7 @@ $out
**PipelineVariable** allows access to the most recent value passed into the
next pipeline segment by the command that uses this parameter. Any command in
the pipeline can access the value using the named **PipelineVariable**. The
value is assigned to the variable when it is passed into the next pipeline
value is assigned to the variable when it's passed into the next pipeline
segment. This makes the **PipelineVariable** easier to use than a specific
temporary variable, which might need to be assigned in multiple locations.

Expand All @@ -393,8 +392,7 @@ allows a command to _feed back_ its output to a previous command (or itself).
> and `end`. When using the **PipelineVariable** parameter with advanced
> functions, only values from the first defined script block are assigned to
> the variable as the function runs. For more information, see
> [Advanced functions](./about_functions_advanced.md). PowerShell 7.2 corrects
> this behavior.
> [Advanced functions][05]. PowerShell 7.2 corrects this behavior.

```yaml
Type: String
Expand All @@ -410,7 +408,7 @@ Accept wildcard characters: False
Valid values are strings, the same as for any variable names.

> [!CAUTION]
> The **PipelineVariable** is scoped to the pipeline in which it is invoked.
> The **PipelineVariable** is scoped to the pipeline in which it's invoked.
> Variables outside the pipeline, which use same name, are cleared before the
> pipeline is executed. The **PipelineVariable** goes out of scope when the
> pipeline terminates. If multiple commands within the pipeline specify the
Expand Down Expand Up @@ -438,7 +436,7 @@ The results of the first `Foreach-Object` command are piped into a second
# Create a variable named $temp
$temp=8
Get-Variable temp
# Note that the variable just created is not available on the
# Note that the variable just created isn't available on the
# pipeline when -PipelineVariable creates the same variable name
1..5 | ForEach-Object -PipelineVariable temp -Begin {
Write-Host "Step1[BEGIN]:`$temp=$temp"
Expand Down Expand Up @@ -499,9 +497,9 @@ displayed by default.

`-Verbose:$true` has the same effect as `-Verbose`

`-Verbose:$false` suppresses the display of verbose messages. Use this parameter
when the value of `$VerbosePreference` isn't **SilentlyContinue** (the
default).
`-Verbose:$false` suppresses the display of verbose messages. Use this
parameter when the value of `$VerbosePreference` isn't **SilentlyContinue**
(the default).

### -WarningAction

Expand All @@ -522,11 +520,10 @@ Accept pipeline input: False
Accept wildcard characters: False
```

The **WarningAction** parameter overrides the value of the
`$WarningPreference` variable for the current command. Because the default
value of the `$WarningPreference` variable is **Continue**, warnings are
displayed and execution continues unless you use the **WarningAction**
parameter.
The **WarningAction** parameter overrides the value of the `$WarningPreference`
variable for the current command. Because the default value of the
`$WarningPreference` variable is **Continue**, warnings are displayed and
execution continues unless you use the **WarningAction** parameter.

`-WarningAction:Break` enters the debugger when a warning occurs.

Expand All @@ -543,7 +540,7 @@ executing the command.
command.

> [!NOTE]
> The **WarningAction** parameter overrides, but does not replace the value of
> The **WarningAction** parameter overrides, but doesn't replace the value of
> the `$WarningAction` preference variable when the parameter is used in a
> command to run a script or function.

Expand All @@ -569,8 +566,8 @@ To append the warnings to the variable content, instead of replacing any
warnings that might already be stored there, type a plus sign (`+`) before the
variable name.

For example, the following command creates the `$a` variable and then stores any
warnings in it:
For example, the following command creates the `$a` variable and then stores
any warnings in it:

```powershell
Get-Process -Id 6 -WarningVariable a
Expand All @@ -588,9 +585,9 @@ The following command displays the contents of `$a`:
$a
```

You can use this parameter to create a variable that contains only warnings from
specific commands. You can use array notation, such as `$a[0]` or `$warning[1,2]`
to refer to specific warnings stored in the variable.
You can use this parameter to create a variable that contains only warnings
from specific commands. You can use array notation, such as `$a[0]` or
`$warning[1,2]` to refer to specific warnings stored in the variable.

> [!NOTE]
> The warning variable contains all warnings generated by the command,
Expand All @@ -614,10 +611,11 @@ Accept pipeline input: False
Accept wildcard characters: False
```

The **WhatIf** parameter overrides the value of the `$WhatIfPreference` variable
for the current command. Because the default value of the `$WhatIfPreference`
variable is 0 (disabled), **WhatIf** behavior isn't done without the
**WhatIf** parameter. For more information, see [about_Preference_Variables](about_Preference_Variables.md)
The **WhatIf** parameter overrides the value of the `$WhatIfPreference`
variable for the current command. Because the default value of the
`$WhatIfPreference` variable is 0 (disabled), **WhatIf** behavior isn't done
without the **WhatIf** parameter. For more information, see
[about_Preference_Variables][03].

`-WhatIf:$true` has the same effect as `-WhatIf`.

Expand All @@ -631,9 +629,8 @@ For example, the following command uses the `-WhatIf` parameter in a
Remove-Item Date.csv -WhatIf
```

Instead of removing the item, PowerShell lists the operations it would
do and the items that would be affected. This command produces the
following output:
Instead of removing the item, PowerShell lists the operations it would do and
the items that would be affected. This command produces the following output:

```output
What if: Performing operation "Remove File" on
Expand All @@ -657,13 +654,13 @@ Accept wildcard characters: False

The **Confirm** parameter overrides the value of the `$ConfirmPreference`
variable for the current command. The default value is true. For more
information, see [about_Preference_Variables](about_Preference_Variables.md)
information, see [about_Preference_Variables][03].

`-Confirm:$true` has the same effect as `-Confirm`.

`-Confirm:$false` suppresses automatic confirmation, which occurs when the value
of `$ConfirmPreference` is less than or equal to the estimated risk of the
cmdlet.
`-Confirm:$false` suppresses automatic confirmation, which occurs when the
value of `$ConfirmPreference` is less than or equal to the estimated risk of
the cmdlet.

For example, the following command uses the **Confirm** parameter with a
`Remove-Item` command. Before removing the item, PowerShell lists the
Expand All @@ -682,16 +679,16 @@ Performing operation "Remove File" on Target " C:\ps-test\tmp1.txt

The Confirm response options are as follows:

| Response | Result |
| ------------------ | ----------------------------------------------------------- |
| `Yes` (`Y`) | Perform the action. |
| `Yes to All` (`A`) | Perform all actions and suppress subsequent Confirm queries |
| | for this command. |
| `No` (`N`): | Do not perform the action. |
| `No to All` (`L`): | Do not perform any actions and suppress subsequent Confirm |
| | queries for this command. |
| `Suspend` (`S`): | Pause the command and create a temporary session. |
| `Help` (`?`) | Display help for these options. |
| Response | Result |
| ------------------ | --------------------------------------------------- |
| `Yes` (`Y`) | Perform the action. |
| `Yes to All` (`A`) | Perform all actions and suppress subsequent Confirm |
| | queries for this command. |
| `No` (`N`): | Don't perform the action. |
| `No to All` (`L`): | Don't perform any actions and suppress subsequent |
| | Confirm queries for this command. |
| `Suspend` (`S`): | Pause the command and create a temporary session. |
| `Help` (`?`) | Display help for these options. |

The **Suspend** option places the command on hold and creates a temporary
nested session in which you can work until you're ready to choose a **Confirm**
Expand All @@ -702,8 +699,8 @@ return to the Confirm options for the original command, type "exit".

In the following example, the **Suspend** option (S) is used to halt a command
temporarily while the user checks the help for a command parameter. After
obtaining the needed information, the user types "exit" to end the nested prompt
and then selects the Yes (y) response to the Confirm query.
obtaining the needed information, the user types "exit" to end the nested
prompt and then selects the Yes (y) response to the Confirm query.

```
PS C:\ps-test> New-Item -ItemType File -Name Test.txt -Confirm
Expand Down Expand Up @@ -749,8 +746,19 @@ about_Common_Parameters

## See also

- [about_Preference_Variables](about_Preference_Variables.md)
- [Write-Debug](xref:Microsoft.PowerShell.Utility.Write-Debug)
- [Write-Error](xref:Microsoft.PowerShell.Utility.Write-Error)
- [Write-Verbose](xref:Microsoft.PowerShell.Utility.Write-Verbose)
- [Write-Warning](xref:Microsoft.PowerShell.Utility.Write-Warning)
- [about_Preference_Variables][03]
- [Write-Debug][11]
- [Write-Error][12]
- [Write-Verbose][13]
- [Write-Warning][14]

<!-- link references -->
[02]: about_Automatic_Variables.md
[03]: about_Preference_Variables.md
[05]: about_functions_advanced.md
[06]: xref:Microsoft.PowerShell.Utility.Write-Progress
[07]: xref:System.Management.Automation.ActionPreference
[11]: xref:Microsoft.PowerShell.Utility.Write-Debug
[12]: xref:Microsoft.PowerShell.Utility.Write-Error
[13]: xref:Microsoft.PowerShell.Utility.Write-Verbose
[14]: xref:Microsoft.PowerShell.Utility.Write-Warning
2 changes: 1 addition & 1 deletion reference/7.3/Microsoft.PowerShell.Utility/Get-Random.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Get-Random -Minimum -100 -Maximum 100

### Example 4: Get a random floating-point number

This command gets a random floating-point number greater than or equal to 10.7 and less than 20.92.
This command gets a random floating-point number greater than or equal to 10.7 and less than 20.93.

```powershell
Get-Random -Minimum 10.7 -Maximum 20.93
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ Accept wildcard characters: False
### -MaximumRetryCount

Specifies how many times PowerShell retries a connection when a failure code between 400 and 599,
inclusive or 304 is received. Also see **RetryIntervalSec** parameter for specifying number of
retries.
inclusive or 304 is received. Also, see the **RetryIntervalSec** parameter for specifying the number
of seconds between retries.

```yaml
Type: System.Int32
Expand Down Expand Up @@ -981,8 +981,9 @@ Accept wildcard characters: False
### -RetryIntervalSec

Specifies the interval between retries for the connection when a failure code between 400 and 599,
inclusive or 304 is received. Also see **MaximumRetryCount** parameter for specifying number of
retries. The value must be between `1` and `[int]::MaxValue`.
inclusive or 304 is received. The value must be between `1` and `[int]::MaxValue`.

Also, see the **MaximumRetryCount** parameter for specifying number of retries.

```yaml
Type: System.Int32
Expand Down
Loading