Skip to content

Commit

Permalink
Fixes #10486 - Add missing common parameters (#10488)
Browse files Browse the repository at this point in the history
* Add missing common parameters

* Fix .NET class names

* Reformat class names
  • Loading branch information
sdwheeler authored Oct 4, 2023
1 parent 0d99156 commit 1f886ac
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 49 deletions.
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: 07/21/2023
ms.date: 10/04/2023
no-loc: [Debug, Verbose, Confirm]
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand Down Expand Up @@ -496,7 +496,7 @@ The valid values are as follows:

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

Required: False
Expand Down
122 changes: 75 additions & 47 deletions reference/docs-conceptual/developer/cmdlet/common-parameter-names.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
description: Common Parameter Names
ms.date: 09/13/2016
ms.date: 10/04/2023
ms.topic: reference
title: Common Parameter Names
---
# Common Parameter Names

The parameters described in this topic are referred to as **common parameters**. They are added to
cmdlets by the Windows PowerShell runtime and cannot be declared by the cmdlet.
The parameters described in this topic are referred to as **common parameters**. They're added to
cmdlets by the PowerShell runtime and can't be declared by the cmdlet.

> [!NOTE]
> These parameters are also added to provider cmdlets and to functions that are decorated with the
Expand All @@ -16,119 +16,147 @@ cmdlets by the Windows PowerShell runtime and cannot be declared by the cmdlet.
## General Common Parameters

The following parameters are added to all cmdlets and can be accessed whenever the cmdlet is run.
These parameters are defined by the [System.Management.Automation.Internal.Commonparameters](/dotnet/api/System.Management.Automation.Internal.CommonParameters)
class.

### Confirm (alias: cf)

Data type: SwitchParameter

This parameter specifies whether the cmdlet displays a prompt that asks if the user is sure that
they want to continue.
These parameters are defined by the [CommonParameters][08] class.

### Debug (alias: db)

Data type: SwitchParameter
Data type: **SwitchParameter**

This parameter specifies whether programmer-level debugging messages that can be displayed at the
command line. These messages are intended for troubleshooting the operation of the cmdlet, and are
generated by calls to the [System.Management.Automation.Cmdlet.WriteDebug](/dotnet/api/System.Management.Automation.Cmdlet.WriteDebug)
method. Debug messages do not need to be localized.
generated by calls to the [WriteDebug][06] method. Debug messages don't need to be localized.

### ErrorAction (alias: ea)

Data type: Enumeration
Data type: **Enumeration**

This parameter specifies what action should take place when an error occurs. The possible values for
this parameter are defined by the [System.Management.Automation.Actionpreference](/dotnet/api/System.Management.Automation.ActionPreference)
enumeration.
this parameter are defined by the [ActionPreference][05] enumeration.

### ErrorVariable (alias: ev)

Data type: String
Data type: **String**

This parameter specifies the variable in which to place objects when an error occurs. To append to
this variable, use +_varname_ rather than clearing and setting the variable.

### InformationAction (alias: infa)

Data type: **Enumeration**

This parameter specifies what action should take place when output is sent to the **Information**
stream. The possible values for this parameter are defined by the [ActionPreference][05]
enumeration.

### InformationVariable (alias: iv)

Data type: **String**

This parameter specifies the variable in which to save output objects written to the **Information**
stream. To append to this variable, use +_varname_ rather than clearing and setting the variable.

### OutBuffer (alias: ob)

Data type: Int32
Data type: **Int32**

This parameter defines the number of objects to store in the output buffer before any objects are
passed down the pipeline. By default, objects are passed immediately down the pipeline.

### OutVariable (alias: ov)

Data type: String
Data type: **String**

This parameter specifies the variable in which to place all output objects generated by the cmdlet.
To append to this variable, use +_varname_ rather than clearing and setting the variable.

### PipelineVariable (alias: pv)

Data type: String
Data type: **String**

This parameter stores the value of the current pipeline element as a variable for any named command
as it flows through the pipeline.

## Verbose (alias: vb)
### ProgressAction (alias: proga)

Data type: **Enumeration**

Data type: SwitchParameter
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider,
such as the progress bars generated by the `Write-Progress` cmdlet.

This parameter was added in PowerShell 7.4.

### Verbose (alias: vb)

Data type: **SwitchParameter**

This parameter specifies whether the cmdlet writes explanatory messages that can be displayed at the
command line. These messages are intended to provide additional help to the user, and are generated
by calls to the [System.Management.Automation.Cmdlet.WriteVerbose](/dotnet/api/System.Management.Automation.Cmdlet.WriteVerbose)
method.
by calls to the [WriteVerbose][07] method.

### WarningAction (alias: wa)

Data type: Enumeration
Data type: **Enumeration**

This parameter specifies what action should take place when the cmdlet writes a warning message. The
possible values for this parameter are defined by the [System.Management.Automation.Actionpreference](/dotnet/api/System.Management.Automation.ActionPreference)
enumeration.
possible values for this parameter are defined by the [ActionPreference][05] enumeration.

### WarningVariable (alias: wv)

Data type: String
Data type: **String**

This parameter specifies the variable in which warning messages can be saved. To append to this
variable, use +_varname_ rather than clearing and setting the variable.

## Risk-Mitigation Parameters

The following parameters are added to cmdlets that requests confirmation before they perform their
action. For more information about confirmation requests, see [Requesting Confirmation](./requesting-confirmation-from-cmdlets.md).
These parameters are defined by the [System.Management.Automation.Internal.Shouldprocessparameters](/dotnet/api/System.Management.Automation.Internal.ShouldProcessParameters)
class.
action. For more information about confirmation requests, see [Requesting Confirmation][02]. These
parameters are defined by the [ShouldProcessParameters][09] class.

### Confirm (alias: cf)

Data type: **SwitchParameter**

This parameter specifies whether the cmdlet displays a prompt that asks if the user is sure that
they want to continue.

### WhatIf (alias: wi)

Data type: SwitchParameter
Data type: **SwitchParameter**

This parameter specifies whether the cmdlet writes a message that describes the effects of running
the cmdlet without actually performing any action.

## Transaction Parameters

The following parameter is added to cmdlets that support transactions. These parameters are defined
by the [System.Management.Automation.Internal.Transactionparameters](/dotnet/api/System.Management.Automation.Internal.TransactionParameters)
class. Transaction support was introduced in PowerShell 3.0 and discontinued in PowerShell 6.0.
by the [TransactionParameters][10] class.

Transaction support was introduced in PowerShell 3.0 and discontinued in PowerShell 6.0.

### UseTransaction (alias: usetx)

Data type: SwitchParameter
Data type: **SwitchParameter**

This parameter specifies whether the cmdlet will use the current transaction to perform its action.
This parameter specifies whether the cmdlet uses the current transaction to perform its action.

## See Also

[System.Management.Automation.Internal.Commonparameters](/dotnet/api/System.Management.Automation.Internal.CommonParameters)

[System.Management.Automation.Internal.Shouldprocessparameters](/dotnet/api/System.Management.Automation.Internal.ShouldProcessParameters)

[System.Management.Automation.Internal.Transactionparameters](/dotnet/api/System.Management.Automation.Internal.TransactionParameters)

[Writing a Windows PowerShell Cmdlet](./writing-a-windows-powershell-cmdlet.md)

[Windows PowerShell SDK](../windows-powershell-reference.md)
- [about_CommonParameters][04]
- [System.Management.Automation.Internal.CommonParameters][08]
- [System.Management.Automation.Internal.ShouldProcessParameters][09]
- [System.Management.Automation.Internal.TransactionParameters][10]
- [Writing a Windows PowerShell Cmdlet][03]
- [Windows PowerShell SDK][01]

<!-- link references -->
[01]: ../windows-powershell-reference.md
[02]: ./requesting-confirmation-from-cmdlets.md
[03]: ./writing-a-windows-powershell-cmdlet.md
[04]: /powershell/module/microsoft.powershell.core/about/about_commonparameters
[05]: xref:System.Management.Automation.ActionPreference
[06]: xref:Microsoft.PowerShell.Utility.Activities.WriteDebug
[07]: xref:Microsoft.PowerShell.Utility.Activities.WriteVerbose
[08]: xref:System.Management.Automation.Internal.CommonParameters
[09]: xref:System.Management.Automation.Internal.ShouldProcessParameters
[10]: xref:System.Management.Automation.Internal.TransactionParameters

0 comments on commit 1f886ac

Please sign in to comment.