Updates from: 07/31/2021 03:15:03
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Core About Functions (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md
description: Describes how to create and use functions in PowerShell. keywords: powershell,cmdlet Locale: en-US Previously updated : 2/27/2019 Last updated : 07/30/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions
see [about_Functions_Advanced](about_Functions_Advanced.md).
## Syntax
-The following is the syntax for a function:
+The following are the syntax for a function:
-```
+```Syntax
function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])]
+{
+ begin {<statement list>}
+ process {<statement list>}
+ end {<statement list>}
+}
+```
+
+```Syntax
+function [<scope:>]<name>
{ param([type]$parameter1 [,[type]$parameter2]) dynamicparam {<statement list>}
functions, see
Functions do not have to be complicated to be useful. The simplest functions have the following format:
-```
+```Syntax
function <function-name> {statements} ```
about dynamic parameters in functions, see
You can define any number of named parameters. You can include a default value for named parameters, as described later in this topic.
-You can define parameters inside the braces using the `Param` keyword, as
+You can define parameters inside the braces using the `param` keyword, as
shown in the following sample syntax:
-```
+```Syntax
function <name> {
- param ([type]$parameter1[,[type]$parameter2])
+ param ([type]$parameter1 [,[type]$parameter2])
<statement list> } ```
function <name> {
You can also define parameters outside the braces without the `Param` keyword, as shown in the following sample syntax:
-```powershell
+```Syntax
function <name> [([type]$parameter1[,[type]$parameter2])] { <statement list> }
function <name> [([type]$parameter1[,[type]$parameter2])] {
Below is an example of this alternative syntax. ```powershell
-Function Add-Numbers($one, $two) {
+function Add-Numbers([int]$one, [int]$two) {
$one + $two } ```
Any function can take input from the pipeline. You can control how a function
processes input from the pipeline using `Begin`, `Process`, and `End` keywords. The following sample syntax shows the three keywords:
-```
+```Syntax
function <name> { begin {<statement list>} process {<statement list>}
Microsoft.PowerShell.Core About Functions (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Functions.md
description: Describes how to create and use functions in PowerShell. keywords: powershell,cmdlet Locale: en-US Previously updated : 2/27/2019 Last updated : 07/30/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions
see [about_Functions_Advanced](about_Functions_Advanced.md).
## Syntax
-The following is the syntax for a function:
+The following are the syntax for a function:
-```
+```Syntax
function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])]
+{
+ begin {<statement list>}
+ process {<statement list>}
+ end {<statement list>}
+}
+```
+
+```Syntax
+function [<scope:>]<name>
{ param([type]$parameter1 [,[type]$parameter2]) dynamicparam {<statement list>}
functions, see
Functions do not have to be complicated to be useful. The simplest functions have the following format:
-```
+```Syntax
function <function-name> {statements} ```
about dynamic parameters in functions, see
You can define any number of named parameters. You can include a default value for named parameters, as described later in this topic.
-You can define parameters inside the braces using the `Param` keyword, as
+You can define parameters inside the braces using the `param` keyword, as
shown in the following sample syntax:
-```
+```Syntax
function <name> {
- param ([type]$parameter1[,[type]$parameter2])
+ param ([type]$parameter1 [,[type]$parameter2])
<statement list> } ```
function <name> {
You can also define parameters outside the braces without the `Param` keyword, as shown in the following sample syntax:
-```powershell
+```Syntax
function <name> [([type]$parameter1[,[type]$parameter2])] { <statement list> }
function <name> [([type]$parameter1[,[type]$parameter2])] {
Below is an example of this alternative syntax. ```powershell
-Function Add-Numbers($one, $two) {
+function Add-Numbers([int]$one, [int]$two) {
$one + $two } ```
Any function can take input from the pipeline. You can control how a function
processes input from the pipeline using `Begin`, `Process`, and `End` keywords. The following sample syntax shows the three keywords:
-```
+```Syntax
function <name> { begin {<statement list>} process {<statement list>}
Microsoft.PowerShell.Core About Functions (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Functions.md
description: Describes how to create and use functions in PowerShell. keywords: powershell,cmdlet Locale: en-US Previously updated : 2/27/2019 Last updated : 07/30/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions
see [about_Functions_Advanced](about_Functions_Advanced.md).
## Syntax
-The following is the syntax for a function:
+The following are the syntax for a function:
-```
+```Syntax
function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])]
+{
+ begin {<statement list>}
+ process {<statement list>}
+ end {<statement list>}
+}
+```
+
+```Syntax
+function [<scope:>]<name>
{ param([type]$parameter1 [,[type]$parameter2]) dynamicparam {<statement list>}
functions, see
Functions do not have to be complicated to be useful. The simplest functions have the following format:
-```
+```Syntax
function <function-name> {statements} ```
about dynamic parameters in functions, see
You can define any number of named parameters. You can include a default value for named parameters, as described later in this topic.
-You can define parameters inside the braces using the `Param` keyword, as
+You can define parameters inside the braces using the `param` keyword, as
shown in the following sample syntax:
-```
+```Syntax
function <name> {
- param ([type]$parameter1[,[type]$parameter2])
+ param ([type]$parameter1 [,[type]$parameter2])
<statement list> } ```
function <name> {
You can also define parameters outside the braces without the `Param` keyword, as shown in the following sample syntax:
-```powershell
+```Syntax
function <name> [([type]$parameter1[,[type]$parameter2])] { <statement list> }
function <name> [([type]$parameter1[,[type]$parameter2])] {
Below is an example of this alternative syntax. ```powershell
-Function Add-Numbers($one, $two) {
+function Add-Numbers([int]$one, [int]$two) {
$one + $two } ```
Any function can take input from the pipeline. You can control how a function
processes input from the pipeline using `Begin`, `Process`, and `End` keywords. The following sample syntax shows the three keywords:
-```
+```Syntax
function <name> { begin {<statement list>} process {<statement list>}
Microsoft.PowerShell.Core About Functions (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Functions.md
--- description: Describes how to create and use functions in PowerShell. Locale: en-US Previously updated : 02/27/2019 Last updated : 07/30/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions
see [about_Functions_Advanced](about_Functions_Advanced.md).
## Syntax
-The following is the syntax for a function:
+The following are the syntax for a function:
-```
+```Syntax
function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])]
+{
+ begin {<statement list>}
+ process {<statement list>}
+ end {<statement list>}
+}
+```
+
+```Syntax
+function [<scope:>]<name>
{ param([type]$parameter1 [,[type]$parameter2]) dynamicparam {<statement list>}
functions, see
Functions do not have to be complicated to be useful. The simplest functions have the following format:
-```
+```Syntax
function <function-name> {statements} ```
about dynamic parameters in functions, see
You can define any number of named parameters. You can include a default value for named parameters, as described later in this topic.
-You can define parameters inside the braces using the `Param` keyword, as
+You can define parameters inside the braces using the `param` keyword, as
shown in the following sample syntax:
-```
+```Syntax
function <name> {
- param ([type]$parameter1[,[type]$parameter2])
+ param ([type]$parameter1 [,[type]$parameter2])
<statement list> } ```
function <name> {
You can also define parameters outside the braces without the `Param` keyword, as shown in the following sample syntax:
-```powershell
+```Syntax
function <name> [([type]$parameter1[,[type]$parameter2])] { <statement list> }
function <name> [([type]$parameter1[,[type]$parameter2])] {
Below is an example of this alternative syntax. ```powershell
-Function Add-Numbers($one, $two) {
+function Add-Numbers([int]$one, [int]$two) {
$one + $two } ```
Any function can take input from the pipeline. You can control how a function
processes input from the pipeline using `Begin`, `Process`, and `End` keywords. The following sample syntax shows the three keywords:
-```
+```Syntax
function <name> { begin {<statement list>} process {<statement list>}
learn 05 Formatting Aliases Providers Comparison https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/learn/ps101/05-formatting-aliases-providers-comparison.md
description: This chapter introduces the concepts of output formatting, command
## Requirements The SQL Server PowerShell module is required by some of the examples shown in this chapter. The
-module installs as part of [SQL Server Management Studio (SMSS)][SMSS]. It's also used in
+module installs as part of [SQL Server Management Studio (SSMS)][SSMS]. It's also used in
subsequent chapters. Download and install it on your Windows 10 lab environment computer. ## Format Right
Providers, and Comparison Operators.
- [about_Arrays][about_Arrays] <!-- link references -->
-[SMSS]: /sql/ssms/download-sql-server-management-studio-ssms
+[SSMS]: /sql/ssms/download-sql-server-management-studio-ssms
[Format-Table]: /powershell/module/microsoft.powershell.utility/format-table [Format-List]: /powershell/module/microsoft.powershell.utility/format-list [Format-Wide]: /powershell/module/microsoft.powershell.utility/format-wide