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

7/2/2024 PM Publish #11232

Merged
merged 2 commits into from
Jul 2, 2024
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
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: 03/25/2024
ms.date: 07/02/2024
no-loc: [Debug, Verbose, Confirm]
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand All @@ -24,7 +24,9 @@ effect on all cmdlets. For example, if a cmdlet doesn't generate any verbose
output, using the **Verbose** common parameter has no effect.

The common parameters are also available on advanced functions that use the
**CmdletBinding** attribute or the **Parameter** attribute.
`CmdletBinding` attribute or the `Parameter` attribute. When you use these
attributes, PowerShell automatically adds the Common Parameters. You can't
create any parameters that use the same names as the Common Parameters.

Several common parameters override system defaults or preferences that you set
using the PowerShell preference variables. Unlike the preference variables, the
Expand All @@ -43,6 +45,7 @@ parentheses.
- **OutVariable** (ov)
- **OutBuffer** (ob)
- **PipelineVariable** (pv)
- **ProgressAction** (proga)
- **Verbose** (vb)
- **WarningAction** (wa)
- **WarningVariable** (wv)
Expand Down Expand Up @@ -468,6 +471,40 @@ At line:1 char:1
+ FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand
```

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script,
cmdlet, or provider, such as the progress bars generated by the
[Write-Progress][06] cmdlet. The `Write-Progress` cmdlet creates progress bars
that show a command's status. The **ProgressAction** parameter was added in
PowerShell 7.4.

The **ProgressAction** parameter takes one of the [`ActionPreference`][07]
enumeration values: `SilentlyContinue`, `Stop`, `Continue`, `Inquire`,
`Ignore`, `Suspend`, or `Break`.

The valid values are as follows:

- `Break` Enters the debugger at an occurrence of the `Write-Progress` command.
- `Stop`: Doesn't display the progress bar. Instead, it displays an error
message and stops executing.
- `Inquire`: Doesn't display the progress bar. Prompts for permission to
continue. If you reply with `Y` or `A`, it displays the progress bar.
- `Continue`: (Default) Displays the progress bar and continues with execution.
- `SilentlyContinue`: Executes the command, but doesn't display the progress
bar.

```yaml
Type: ActionPreference
Aliases: proga
Accepted values: Break, Suspend, Ignore, Inquire, Continue, Stop, SilentlyContinue
Required: False
Position: Named
Default value: Depends on preference variable
Accept pipeline input: False
Accept wildcard characters: False
```

### -Verbose

Displays detailed information about the operation done by the command. This
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Explains how to add parameters to advanced functions.
Locale: en-US
ms.date: 06/22/2023
ms.date: 07/02/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Functions Advanced Parameters
Expand All @@ -19,10 +19,9 @@ You can add parameters to the advanced functions that you write, and use
parameter attributes and arguments to limit the parameter values that function
users submit with the parameter.

The parameters that you add to your function are available to users in addition
to the common parameters that PowerShell adds automatically to all cmdlets and
advanced functions. For more information about the PowerShell common
parameters, see [about_CommonParameters][06].
When you use the `CmdletBinding` attribute, PowerShell automatically adds the
Common Parameters. You can't create any parameters that use the same names as
the Common Parameters. For more information, see [about_CommonParameters][06].

Beginning in PowerShell 3.0, you can use splatting with `@Args` to represent
the parameters in a command. Splatting is valid on simple and advanced
Expand Down Expand Up @@ -82,7 +81,7 @@ function Get-Date_Func {
}
}

[cultureinfo]::CurrentCulture = 'de-DE'
[CultureInfo]::CurrentCulture = 'de-DE'

# This German-format date string doesn't work with the invariant culture.
# E.g., [datetime] '19-06-2018' breaks.
Expand Down Expand Up @@ -205,7 +204,7 @@ they can be difficult for users to discover. To find a dynamic parameter, the
user must be in the provider path, use the **ArgumentList** parameter of the
`Get-Command` cmdlet, or use the **Path** parameter of `Get-Help`.

To create a dynamic parameter for a function or script, use the `DynamicParam`
To create a dynamic parameter for a function or script, use the `dynamicparam`
keyword.

The syntax is as follows:
Expand All @@ -227,7 +226,7 @@ function Get-Sample {
[CmdletBinding()]
param([string]$Name, [string]$Path)

DynamicParam
dynamicparam
{
if ($Path.StartsWith("HKLM:"))
{
Expand All @@ -251,7 +250,8 @@ function Get-Sample {
}
```

For more information, see the documentation for the [RuntimeDefinedParameter][02] type.
For more information, see the documentation for the
[RuntimeDefinedParameter][02] type.

## Attributes of parameters

Expand Down Expand Up @@ -730,7 +730,7 @@ more information, see [about_Wildcards][19].

The **ArgumentCompleter** attribute allows you to add tab completion values to
a specific parameter. An **ArgumentCompleter** attribute must be defined for
each parameter that needs tab completion. Like **DynamicParameters**, the
each parameter that needs tab completion. Like **dynamicparameters**, the
available values are calculated at runtime when the user presses <kbd>Tab</kbd>
after the parameter name.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the attribute that makes a function work like a compiled cmdlet.
Locale: en-US
ms.date: 09/23/2021
ms.date: 07/02/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_cmdletbindingattribute?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Functions CmdletBindingAttribute
Expand All @@ -17,6 +17,10 @@ The `CmdletBinding` attribute is an attribute of functions that makes them
operate like compiled cmdlets written in C#. It provides access to the features
of cmdlets.

When you use the `CmdletBinding` attribute, PowerShell automatically adds the
Common Parameters. You can't create any parameters that use the same names as
the Common Parameters. For more information, see [about_CommonParameters][02].

PowerShell binds the parameters of functions that have the `CmdletBinding`
attribute in the same way that it binds the parameters of compiled cmdlets. The
`$PSCmdlet` automatic variable is available to functions with the
Expand Down Expand Up @@ -90,7 +94,7 @@ be confirmed by a call to the **ShouldProcess** method. The call to the
argument is also specified.

For more information about confirmation requests, see
[Requesting Confirmation](/powershell/scripting/developer/cmdlet/requesting-confirmation).
[Requesting Confirmation][01].

## DefaultParameterSetName

Expand Down Expand Up @@ -197,7 +201,7 @@ The **Position** argument of the **Parameter** attribute takes precedence over
the **PositionalBinding** default value. You can use the **Position** argument
to specify a position value for a parameter. For more information about the
**Position** argument, see
[about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md).
[about_Functions_Advanced_Parameters][04].

## Notes

Expand All @@ -209,8 +213,17 @@ about_Functions_CmdletBinding_Attribute

## See also

- [about_Functions](about_Functions.md)
- [about_Functions_Advanced](about_Functions_Advanced.md)
- [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
- [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md)
- [about_Functions_OutputTypeAttribute](about_Functions_OutputTypeAttribute.md)
- [about_Functions][07]
- [about_Functions_Advanced][05]
- [about_Functions_Advanced_Methods][03]
- [about_Functions_Advanced_Parameters][04]
- [about_Functions_OutputTypeAttribute][06]

<!-- link references -->
[01]: /powershell/scripting/developer/cmdlet/requesting-confirmation
[02]: about_CommonParameters.md
[03]: about_Functions_Advanced_Methods.md
[04]: about_Functions_Advanced_Parameters.md
[05]: about_Functions_Advanced.md
[06]: about_Functions_OutputTypeAttribute.md
[07]: about_Functions.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Explains the differences between the [psobject] and [pscustomobject] type accelerators.
Locale: en-US
ms.date: 10/11/2023
ms.date: 07/02/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about PSCustomObject
Expand Down Expand Up @@ -187,7 +187,7 @@ While, casting an object to `[psobject]` appears to have no affect on the type,
PowerShell adds an _invisible_ `[psobject]` wrapper around the object. This can
have subtle side effects.

- Wrapped objects will match their original type and the `[psobject]` type.
- Wrapped objects match their original type and the `[psobject]` type.

```powershell
PS> 1 -is [Int32]
Expand All @@ -209,13 +209,53 @@ have subtle side effects.
PS> '{0} {1}' -f ([psobject] (1, 2))
Error formatting a string: Index (zero based) must be greater than or equal
to zero and less than the size of the argument list..
At line:1 char:1
+ '{0} {1}' -f ([psobject] (1, 2))
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({0} {1}:String) [], RuntimeException
+ FullyQualifiedErrorId : FormatError
```

## Conversion of hashtables containing similar keys

Case-sensitive dictionaries might contain key names that only differ by case.
When you cast such a dictionary to a `[pscustomobject]`, PowerShell preserves
that case of the keys but isn't case-sensitive. As a result:

- The case of the first duplicate key becomes the name of that key.
- The value of the last case-variant key becomes the property value.

The following example demonstrates this behavior:

```powershell
$OrderedHashTable = [System.Collections.Specialized.OrderedDictionary]::new()
$OrderedHashTable['One'] = 1
$OrderedHashTable['TWO'] = 2
$OrderedHashTable['two'] = 3 # case variation
$OrderedHashTable['Three'] = 3
$OrderedHashTable
```

Notice that the ordered hashtable contains multiple keys that differ only by
case.

```Output
Name Value
---- -----
One 1
TWO 2
two 3
Three 3
```

When that hashtable is cast to a `[pscustomobject]`, the case of the name of
first key is used, but that value of the last matching key name is used.

```powershell
[PSCustomObject]$OrderedHashTable
```

```Output
One TWO Three
--- --- -----
1 3 3
```

## Notes

In Windows PowerShell, objects created by casting a **Hashtable** to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Lists the reserved words that cannot be used as identifiers because they have a special meaning in PowerShell.
Locale: en-US
ms.date: 07/23/2020
ms.date: 07/02/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_reserved_words?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Reserved Words
Expand Down Expand Up @@ -44,15 +44,15 @@ enum private
(*) These keywords are reserved for future use.
```

Several language keywords, including `Foreach`, `If`, `For`, and `While`, have
Several language keywords, including `foreach`, `if`, `for`, and `while`, have
their own help articles. To view them, type `Get-Help about_` and add the
keyword. For example, to get information about the `Foreach` statement, type:
keyword. For example, to get information about the `foreach` statement, type:

```powershell
Get-Help about_ForEach
```

For information about the `Filter` statement or the `Return` statement syntax,
For information about the `filter` statement or the `return` statement syntax,
type:

```powershell
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: 04/02/2024
ms.date: 07/02/2024
no-loc: [Debug, Verbose, Confirm]
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand All @@ -24,7 +24,9 @@ effect on all cmdlets. For example, if a cmdlet doesn't generate any verbose
output, using the **Verbose** common parameter has no effect.

The common parameters are also available on advanced functions that use the
**CmdletBinding** attribute or the **Parameter** attribute.
`CmdletBinding` attribute or the `Parameter` attribute. When you use these
attributes, PowerShell automatically adds the Common Parameters. You can't
create any parameters that use the same names as the Common Parameters.

Several common parameters override system defaults or preferences that you set
using the PowerShell preference variables. Unlike the preference variables, the
Expand All @@ -43,6 +45,7 @@ parentheses.
- **OutVariable** (ov)
- **OutBuffer** (ob)
- **PipelineVariable** (pv)
- **ProgressAction** (proga)
- **Verbose** (vb)
- **WarningAction** (wa)
- **WarningVariable** (wv)
Expand Down Expand Up @@ -454,6 +457,40 @@ Step1[PROCESS]:$temp=4 - $_=5
Get-Variable: Cannot find a variable with the name 'temp'.
```

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script,
cmdlet, or provider, such as the progress bars generated by the
[Write-Progress][06] cmdlet. The `Write-Progress` cmdlet creates progress bars
that show a command's status. The **ProgressAction** parameter was added in
PowerShell 7.4.

The **ProgressAction** parameter takes one of the [`ActionPreference`][07]
enumeration values: `SilentlyContinue`, `Stop`, `Continue`, `Inquire`,
`Ignore`, `Suspend`, or `Break`.

The valid values are as follows:

- `Break` Enters the debugger at an occurrence of the `Write-Progress` command.
- `Stop`: Doesn't display the progress bar. Instead, it displays an error
message and stops executing.
- `Inquire`: Doesn't display the progress bar. Prompts for permission to
continue. If you reply with `Y` or `A`, it displays the progress bar.
- `Continue`: (Default) Displays the progress bar and continues with execution.
- `SilentlyContinue`: Executes the command, but doesn't display the progress
bar.

```yaml
Type: ActionPreference
Aliases: proga
Accepted values: Break, Suspend, Ignore, Inquire, Continue, Stop, SilentlyContinue
Required: False
Position: Named
Default value: Depends on preference variable
Accept pipeline input: False
Accept wildcard characters: False
```

### -Verbose

Displays detailed information about the operation done by the command. This
Expand Down
Loading