Updates from: 09/24/2021 03:22:24
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Core About Functions Advanced Parameters (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md
--- description: Explains how to add parameters to advanced functions. Locale: en-US Previously updated : 07/28/2021 Last updated : 09/23/2021 online version: https://docs.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
value is required.
- Switch parameters should not be given default values. They should always default to false.-- Switch parameters are excluded from positional parameters by default.
- Even when other parameters are implicitly positional, switch parameters are not.
+- Switch parameters are excluded from positional parameters by default.
+ Even when other parameters are implicitly positional, switch parameters are not.
You _can_ override that in the Parameter attribute, but it will confuse users. - Switch parameters should be designed so that setting them moves a command from its default functionality to a less common or more complicated mode. The
The following example declares the **ComputerName** parameter. It uses the
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[string[]] $ComputerName )
parameter set, a **UserName** parameter in the `User` parameter set, and a
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[switch] $Summary )
the `Computer` parameter set and mandatory in the `User` parameter set.
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false, ParameterSetName="Computer")]
- [Parameter(Mandatory=$true, ParameterSetName="User")]
+ [Parameter(ParameterSetName="Computer")]
+ [Parameter(Mandatory, ParameterSetName="User")]
[switch] $Summary )
and accepts an object that's passed to the function from the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipeline=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipeline)]
[string[]] $ComputerName )
the function through the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipelineByPropertyName=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipelineByPropertyName)]
[string[]] $ComputerName )
function Test-Remainder
{ param( [string]
- [Parameter(Mandatory = $true, Position=0)]
+ [Parameter(Mandatory, Position=0)]
$Value, [string[]] [Parameter(Position=1, ValueFromRemainingArguments)]
for the function (for example, `.SYNOPSIS`) then this message also shows up in
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
HelpMessage="Enter one or more computer names separated by commas.")] [string[]] $ComputerName
The following example shows a parameter declaration that adds the **CN** and
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[Alias("CN","MachineName")] [string[]] $ComputerName
for a mandatory **Path** parameter that supports wildcard values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[SupportsWildcards()] [string[]] $Path
that can have a **null** value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowNull()] [hashtable] $ComputerInfo
parameter that can have an empty string value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyString()] [string] $ComputerName
parameter to be an empty collection `@()`. The following example declares a
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyCollection()] [string[]] $ComputerName
takes one to five parameter values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateCount(1,5)] [string[]] $ComputerName
In the following example, each computer name must have one to ten characters.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateLength(1,10)] [string[]] $ComputerName
and each digit must be a number zero to nine.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidatePattern("[0-9][0-9][0-9][0-9]")] [string[]] $ComputerName
four-digit number, and each digit must be a number zero to nine.
The **ValidateRange** attribute specifies a numeric range for each parameter or variable value. PowerShell generates an error if any value is outside that
-range.
+range.
In the following example, the value of the **Attempts** parameter must be between zero and ten. ```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateRange(0,10)] [Int] $Attempts
greater than or equal to the current date.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateScript({$_ -ge (Get-Date)})] [DateTime] $EventDate
High.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateSet("Low", "Average", "High")] [string[]] $Detail
In the following example, the value of the **ID** parameter can't be `$null`.
```powershell Param(
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[ValidateNotNull()] $ID )
empty string (`""`), or an empty array `@()`.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [string[]] $UserName
If you use relative path, the current drive must be `User`.
function Test-UserDrivePath{ [OutputType([bool])] Param(
- [Parameter(Mandatory=, Position=0)][ValidateUserDrive()][string]$Path
+ [Parameter(Mandatory, Position=0)][ValidateUserDrive()][string]$Path
) $True }
Microsoft.PowerShell.Core About Functions Cmdletbindingattribute (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_CmdletBindingAttribute.md
--- description: Describes the attribute that makes a function work like a compiled cmdlet. Locale: en-US Previously updated : 06/11/2020 Last updated : 09/23/2021 online version: https://docs.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
each argument follows this example.
} ```
+The boolean argument types of the **CmdletBinding** attribute default to
+**False** when omitted from the **CmdletBinding** attribute. Set the argument
+value to `$true` or just list the argument by name. For example, the following
+**CmdletBinding** attributes are equivalent.
+
+```powershell
+{
+ [CmdletBinding(SupportsPaging=$true)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+
+# Boolean arguments can be defined using this shorthand syntax
+
+{
+ [CmdletBinding(SupportsPaging)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+```
+ ## ConfirmImpact The **ConfirmImpact** argument specifies when the action of the function should
parameters to an advanced function.
```powershell function Get-Numbers {
- [CmdletBinding(SupportsPaging = $true)]
+ [CmdletBinding(SupportsPaging)]
param() $FirstNumber = [Math]::Min($PSCmdlet.PagingParameters.Skip, 100)
Microsoft.PowerShell.Core About Functions Advanced Parameters (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md
a file system drive.
You can also create a parameter that appears only when another parameter is used in the function command or when another parameter has a certain value.
-Dynamic parameters can be useful, but use them only when necessary, because
+Dynamic parameters can be useful, but use them only when necessary because
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`.
The following example declares the **ComputerName** parameter. It uses the
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[string[]] $ComputerName )
parameter set, a **UserName** parameter in the `User` parameter set, and a
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[switch] $Summary )
the `Computer` parameter set and mandatory in the `User` parameter set.
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false, ParameterSetName="Computer")]
- [Parameter(Mandatory=$true, ParameterSetName="User")]
+ [Parameter(ParameterSetName="Computer")]
+ [Parameter(Mandatory, ParameterSetName="User")]
[switch] $Summary )
and accepts an object that's passed to the function from the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipeline=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipeline)]
[string[]] $ComputerName )
the function through the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipelineByPropertyName=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipelineByPropertyName)]
[string[]] $ComputerName )
function Test-Remainder
{ param( [string]
- [Parameter(Mandatory = $true, Position=0)]
+ [Parameter(Mandatory, Position=0)]
$Value, [string[]] [Parameter(Position=1, ValueFromRemainingArguments)]
for the function (for example, `.SYNOPSIS`) then this message also shows up in
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
HelpMessage="Enter one or more computer names separated by commas.")] [string[]] $ComputerName
The following example shows a parameter declaration that adds the **CN** and
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[Alias("CN","MachineName")] [string[]] $ComputerName
for a mandatory **Path** parameter that supports wildcard values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[SupportsWildcards()] [string[]] $Path
that can have a **null** value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowNull()] [hashtable] $ComputerInfo
parameter that can have an empty string value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyString()] [string] $ComputerName
parameter to be an empty collection `@()`. The following example declares a
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyCollection()] [string[]] $ComputerName
takes one to five parameter values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateCount(1,5)] [string[]] $ComputerName
In the following example, each computer name must have one to ten characters.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateLength(1,10)] [string[]] $ComputerName
and each digit must be a number zero to nine.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidatePattern("[0-9][0-9][0-9][0-9]")] [string[]] $ComputerName
between zero and ten.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateRange(0,10)] [Int] $Attempts
greater than or equal to the current date.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateScript({$_ -ge (Get-Date)})] [DateTime] $EventDate
High.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateSet("Low", "Average", "High")] [string[]] $Detail
In the following example, the value of the **ID** parameter can't be `$null`.
```powershell Param(
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[ValidateNotNull()] $ID )
empty string (`""`), or an empty array `@()`.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [string[]] $UserName
If you use relative path, the current drive must be `User`.
function Test-UserDrivePath{ [OutputType([bool])] Param(
- [Parameter(Mandatory=, Position=0)][ValidateUserDrive()][string]$Path
+ [Parameter(Mandatory, Position=0)][ValidateUserDrive()][string]$Path
) $True }
Microsoft.PowerShell.Core About Functions Cmdletbindingattribute (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Functions_CmdletBindingAttribute.md
--- description: Describes the attribute that makes a function work like a compiled cmdlet. Locale: en-US Previously updated : 06/11/2020 Last updated : 09/23/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_cmdletbindingattribute?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions CmdletBindingAttribute
each argument follows this example.
} ```
+The boolean argument types of the **CmdletBinding** attribute default to
+**False** when omitted from the **CmdletBinding** attribute. Set the argument
+value to `$true` or just list the argument by name. For example, the following
+**CmdletBinding** attributes are equivalent.
+
+```powershell
+{
+ [CmdletBinding(SupportsPaging=$true)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+
+# Boolean arguments can be defined using this shorthand syntax
+
+{
+ [CmdletBinding(SupportsPaging)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+```
+ ## ConfirmImpact The **ConfirmImpact** argument specifies when the action of the function should
parameters to an advanced function.
```powershell function Get-Numbers {
- [CmdletBinding(SupportsPaging = $true)]
+ [CmdletBinding(SupportsPaging)]
param() $FirstNumber = [Math]::Min($PSCmdlet.PagingParameters.Skip, 100)
Microsoft.PowerShell.Core About Functions Advanced Parameters (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md
The following example declares the **ComputerName** parameter. It uses the
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[string[]] $ComputerName )
parameter set, a **UserName** parameter in the `User` parameter set, and a
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[switch] $Summary )
the `Computer` parameter set and mandatory in the `User` parameter set.
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false, ParameterSetName="Computer")]
- [Parameter(Mandatory=$true, ParameterSetName="User")]
+ [Parameter(ParameterSetName="Computer")]
+ [Parameter(Mandatory, ParameterSetName="User")]
[switch] $Summary )
and accepts an object that's passed to the function from the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipeline=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipeline)]
[string[]] $ComputerName )
the function through the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipelineByPropertyName=$true)]
+ [Parameter(Mandatory=,
+ ValueFromPipelineByPropertyName)]
[string[]] $ComputerName )
function Test-Remainder
{ param( [string]
- [Parameter(Mandatory = $true, Position=0)]
+ [Parameter(Mandatory, Position=0)]
$Value, [string[]] [Parameter(Position=1, ValueFromRemainingArguments)]
for the function (for example, `.SYNOPSIS`) then this message also shows up in
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
HelpMessage="Enter one or more computer names separated by commas.")] [string[]] $ComputerName
The following example shows a parameter declaration that adds the **CN** and
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[Alias("CN","MachineName")] [string[]] $ComputerName
for a mandatory **Path** parameter that supports wildcard values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[SupportsWildcards()] [string[]] $Path
that can have a **null** value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowNull()] [hashtable] $ComputerInfo
parameter that can have an empty string value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyString()] [string] $ComputerName
parameter to be an empty collection `@()`. The following example declares a
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyCollection()] [string[]] $ComputerName
takes one to five parameter values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateCount(1,5)] [string[]] $ComputerName
In the following example, each computer name must have one to ten characters.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateLength(1,10)] [string[]] $ComputerName
and each digit must be a number zero to nine.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidatePattern("[0-9][0-9][0-9][0-9]")] [string[]] $ComputerName
between zero and ten.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateRange(0,10)] [Int] $Attempts
greater than or equal to the current date.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateScript({$_ -ge (Get-Date)})] [DateTime] $EventDate
High.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateSet("Low", "Average", "High")] [string[]] $Detail
In the following example, the value of the **ID** parameter can't be `$null`.
```powershell Param(
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[ValidateNotNull()] $ID )
empty string (`""`), or an empty array `@()`.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [string[]] $UserName
If you use relative path, the current drive must be `User`.
function Test-UserDrivePath{ [OutputType([bool])] Param(
- [Parameter(Mandatory=, Position=0)][ValidateUserDrive()][string]$Path
+ [Parameter(Mandatory, Position=0)][ValidateUserDrive()][string]$Path
) $True }
Microsoft.PowerShell.Core About Functions Cmdletbindingattribute (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Functions_CmdletBindingAttribute.md
--- description: Describes the attribute that makes a function work like a compiled cmdlet. Locale: en-US Previously updated : 06/11/2020 Last updated : 09/23/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_cmdletbindingattribute?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions CmdletBindingAttribute
each argument follows this example.
} ```
+The boolean argument types of the **CmdletBinding** attribute default to
+**False** when omitted from the **CmdletBinding** attribute. Set the argument
+value to `$true` or just list the argument by name. For example, the following
+**CmdletBinding** attributes are equivalent.
+
+```powershell
+{
+ [CmdletBinding(SupportsPaging=$true)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+
+# Boolean arguments can be defined using this shorthand syntax
+
+{
+ [CmdletBinding(SupportsPaging)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+```
+ ## ConfirmImpact The **ConfirmImpact** argument specifies when the action of the function should
parameters to an advanced function.
```powershell function Get-Numbers {
- [CmdletBinding(SupportsPaging = $true)]
+ [CmdletBinding(SupportsPaging)]
param() $FirstNumber = [Math]::Min($PSCmdlet.PagingParameters.Skip, 100)
Microsoft.PowerShell.Utility Export Csv (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Export-Csv.md
$AppService = (Get-Service -DisplayName *Application* | Select-Object -Property
$AppService | Export-Csv -Path .\Services.Csv -NoTypeInformation Get-Content -Path .\Services.Csv $WinService = (Get-Service -DisplayName *Windows* | Select-Object -Property DisplayName, Status)
-$WinService | Export-Csv -Path ./Services.csv -NoTypeInformation -Append
+$WinService | Export-Csv -Path .\Services.csv -NoTypeInformation -Append
Get-Content -Path .\Services.Csv ```
PSReadLine About Psreadline (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/PSReadLine/About/about_PSReadLine.md
--- description: PSReadLine provides an improved command-line editing experience in the PowerShell console. Locale: en-US Previously updated : 11/16/2020 Last updated : 09/23/2021 online version: https://docs.microsoft.com/powershell/module/psreadline/about/about_psreadline?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about PSReadLine --- # about_PSReadLine
-## about_PSReadLine
- ## Short Description PSReadLine provides an improved command-line editing experience in the
PowerShell console.
## Long Description
-PSReadLine 2.1 provides a powerful command-line editing experience for the
+PSReadLine 2.0 provides a powerful command-line editing experience for the
PowerShell console. It provides: - Syntax coloring of the command line
PowerShell console. It provides:
- Many configuration options - Bash style completion (optional in Cmd mode, default in Emacs mode) - Emacs yank/kill-ring-- PowerShell token based "word" movement and kill-- Predictive IntelliSense
+- PowerShell token based "word" movement and deletion
-PSReadLine requires PowerShell 3.0, or newer, and the console host. It does
-not work in PowerShell ISE. It does work in the console of Visual Studio Code.
+PSReadLine requires PowerShell 3.0, or newer. PSReadLine works with default
+console host, Visual Studio Code, and Window Terminal. It does not work in
+PowerShell ISE.
-PSReadLine 2.1.0 ships with PowerShell 7.1 and is supported in all supported
+PSReadLine 2.1.0 ships with PowerShell 7.2 and is supported in all supported
versions of PowerShell. It is available to install from the PowerShell Gallery. To install PSReadLine 2.1.0 in a supported version of PowerShell run the following command.
Install-Module -Name PSReadLine -RequiredVersion 2.1.0
> PowerShell 7.0 on Windows works properly. You can manually load the module if > necessary.
-## Predictive IntelliSense
-
-Predictive IntelliSense is an addition to the concept of tab completion that
-assists the user in successfully completing commands. It enables users to
-discover, edit, and execute full commands based on matching predictions from the
-user's history and additional domain specific plugins.
-
-### Enable Predictive IntelliSense
-
-Predictive IntelliSense is disabled by default. To enable predictions, just run
-the following command:
-
-```powershell
-Set-PSReadLineOption -PredictionSource History
-```
-
-The **PredictionSource** parameter can also accept plugins for domain specific
-and custom requirements.
-
-To disable Predictive IntelliSense, just run:
-
-```powershell
-Set-PSReadLineOption -PredictionSource None
-```
-
-The following functions are available in the class
-**[Microsoft.PowerShell.PSConsoleReadLine]**.
## Basic editing functions ### Abort
-Abort current action, e.g. incremental history search.
+Abort current action, for example: incremental history search.
- Emacs: `<Ctrl+g>`
then recall the next item from history the next time ReadLine is called.
### AcceptLine Attempt to execute the current input. If the current input is incomplete (for
-example there is a missing closing parenthesis, bracket, or quote, then the
+example there is a missing closing parenthesis, bracket, or quote) then the
continuation prompt is displayed on the next line and PSReadLine waits for keys to edit the current input.
Repeat the last text modification.
### RevertLine
-Reverts all of the input to the current input.
+Reverts all input to the current input.
- Cmd: `<Escape>` - Emacs: `<Alt+r>`, `<Escape,r>`
word to the cursor. The cleared text is placed in the kill-ring.
### ValidateAndAcceptLine Attempt to execute the current input. If the current input is incomplete (for
-example there is a missing closing parenthesis, bracket, or quote, then the
+example there is a missing closing parenthesis, bracket, or quote) then the
continuation prompt is displayed on the next line and PSReadLine waits for keys to edit the current input.
A new line is inserted below the current line.
### ViBackwardDeleteGlob
-Deletes the previous word, using only white space as the word delimiter.
+Deletes the previous word, using only whitespace as the word delimiter.
- Vi command mode: `<d,B>` ### ViBackwardGlob
-Moves the cursor back to the beginning of the previous word, using only white
-space as delimiters.
+Moves the cursor back to the beginning of the previous word, using only
+whitespace as delimiters.
- Vi command mode: `<B>`
Delete to the end of the word.
### ViDeleteGlob
-Delete the next glob (white space delimited word).
+Delete the next glob (whitespace delimited word).
- Vi command mode: `<d,W>`
the cursor to the next line of multi-line input.
### ViEndOfGlob
-Moves the cursor to the end of the word, using only white space as delimiters.
+Moves the cursor to the end of the word, using only whitespace as delimiters.
- Vi command mode: `<E>` ### ViEndOfPreviousGlob
-Moves to the end of the previous word, using only white space as a word
+Moves to the end of the previous word, using only whitespace as a word
delimiter. - Function is unbound.
Similar to GotoBrace, but is character based instead of token based.
### ViNextGlob
-Moves to the next word, using only white space as a word delimiter.
+Moves to the next word, using only whitespace as a word delimiter.
- Vi command mode: `<W>`
Accept the current inline or selected suggestion.
### CaptureScreen Start interactive screen capture - up/down arrows select lines, enter copies
-selected text to clipboard as text and html.
+selected text to clipboard as text and HTML.
- Function is unbound.
Start a new digit argument to pass to other functions.
### InvokePrompt Erases the current prompt and calls the prompt function to redisplay the
-prompt. Useful for custom key handlers that change state, e.g. change the
-current directory.
+prompt. Useful for custom key handlers that change state. For example, change
+the current directory.
- Function is unbound.
You can bind a ScriptBlock to a key. The ScriptBlock can do pretty much
anything you want. Some useful examples include - edit the command line-- opening a new window (e.g. help)
+- opening a new window (for example, help)
- change directories without changing the command line The ScriptBlock receives two arguments:
a custom key binding.
void GetSelectionState([ref] int start, [ref] int length) ```
-If there is no selection on the command line, -1 will be returned in both
+If there is no selection on the command line, the function returns -1 in both
start and length. If there is a selection on the command line, the start and length of the selection are returned.
typical call looks like
[ref]$numericArg, 1) ```
-## Note
+## Notes
### Command History
Microsoft.PowerShell.Core About Functions Advanced Parameters (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md
--- description: Explains how to add parameters to advanced functions. Locale: en-US Previously updated : 07/28/2021 Last updated : 09/23/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions Advanced Parameters
value is required.
- Switch parameters should not be given default values. They should always default to false.-- Switch parameters are excluded from positional parameters by default.
- Even when other parameters are implicitly positional, switch parameters are not.
+- Switch parameters are excluded from positional parameters by default.
+ Even when other parameters are implicitly positional, switch parameters are not.
You _can_ override that in the Parameter attribute, but it will confuse users. - Switch parameters should be designed so that setting them moves a command from its default functionality to a less common or more complicated mode. The
The following example declares the **ComputerName** parameter. It uses the
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[string[]] $ComputerName )
parameter set, a **UserName** parameter in the `User` parameter set, and a
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[switch] $Summary )
the `Computer` parameter set and mandatory in the `User` parameter set.
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="Computer")] [string[]] $ComputerName,
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
ParameterSetName="User")] [string[]] $UserName,
- [Parameter(Mandatory=$false, ParameterSetName="Computer")]
- [Parameter(Mandatory=$true, ParameterSetName="User")]
+ [Parameter(ParameterSetName="Computer")]
+ [Parameter(Mandatory, ParameterSetName="User")]
[switch] $Summary )
and accepts an object that's passed to the function from the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipeline=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipeline)]
[string[]] $ComputerName )
the function through the pipeline.
```powershell Param(
- [Parameter(Mandatory=$true,
- ValueFromPipelineByPropertyName=$true)]
+ [Parameter(Mandatory,
+ ValueFromPipelineByPropertyName)]
[string[]] $ComputerName )
function Test-Remainder
{ param( [string]
- [Parameter(Mandatory = $true, Position=0)]
+ [Parameter(Mandatory, Position=0)]
$Value, [string[]] [Parameter(Position=1, ValueFromRemainingArguments)]
for the function (for example, `.SYNOPSIS`) then this message also shows up in
```powershell Param(
- [Parameter(Mandatory=$true,
+ [Parameter(Mandatory,
HelpMessage="Enter one or more computer names separated by commas.")] [string[]] $ComputerName
The following example shows a parameter declaration that adds the **CN** and
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[Alias("CN","MachineName")] [string[]] $ComputerName
for a mandatory **Path** parameter that supports wildcard values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[SupportsWildcards()] [string[]] $Path
that can have a **null** value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowNull()] [hashtable] $ComputerInfo
parameter that can have an empty string value.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyString()] [string] $ComputerName
parameter to be an empty collection `@()`. The following example declares a
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[AllowEmptyCollection()] [string[]] $ComputerName
takes one to five parameter values.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateCount(1,5)] [string[]] $ComputerName
In the following example, each computer name must have one to ten characters.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateLength(1,10)] [string[]] $ComputerName
and each digit must be a number zero to nine.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidatePattern("[0-9][0-9][0-9][0-9]")] [string[]] $ComputerName
between zero and ten.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateRange(0,10)] [Int] $Attempts
greater than or equal to the current date.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateScript({$_ -ge (Get-Date)})] [DateTime] $EventDate
High.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateSet("Low", "Average", "High")] [string[]] $Detail
In the following example, the value of the **ID** parameter can't be `$null`.
```powershell Param(
- [Parameter(Mandatory=$false)]
+ [Parameter()]
[ValidateNotNull()] $ID )
empty string (`""`), or an empty array `@()`.
```powershell Param(
- [Parameter(Mandatory=$true)]
+ [Parameter(Mandatory)]
[ValidateNotNullOrEmpty()] [string[]] $UserName
If you use relative path, the current drive must be `User`.
function Test-UserDrivePath{ [OutputType([bool])] Param(
- [Parameter(Mandatory=, Position=0)][ValidateUserDrive()][string]$Path
+ [Parameter(Mandatory, Position=0)][ValidateUserDrive()][string]$Path
) $True }
Microsoft.PowerShell.Core About Functions Cmdletbindingattribute (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Functions_CmdletBindingAttribute.md
--- description: Describes the attribute that makes a function work like a compiled cmdlet. Locale: en-US Previously updated : 06/11/2020 Last updated : 09/23/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_cmdletbindingattribute?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Functions CmdletBindingAttribute
each argument follows this example.
} ```
+The boolean argument types of the **CmdletBinding** attribute default to
+**False** when omitted from the **CmdletBinding** attribute. Set the argument
+value to `$true` or just list the argument by name. For example, the following
+**CmdletBinding** attributes are equivalent.
+
+```powershell
+{
+ [CmdletBinding(SupportsPaging=$true)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+
+# Boolean arguments can be defined using this shorthand syntax
+
+{
+ [CmdletBinding(SupportsPaging)]
+
+ Param ($Parameter1)
+ Begin{}
+ Process{}
+ End{}
+}
+```
+ ## ConfirmImpact The **ConfirmImpact** argument specifies when the action of the function should
parameters to an advanced function.
```powershell function Get-Numbers {
- [CmdletBinding(SupportsPaging = $true)]
+ [CmdletBinding(SupportsPaging)]
param() $FirstNumber = [Math]::Min($PSCmdlet.PagingParameters.Skip, 100)
PSReadLine About Psreadline (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/PSReadLine/About/about_PSReadLine.md
--- description: PSReadLine provides an improved command-line editing experience in the PowerShell console. Locale: en-US Previously updated : 11/23/2020 Last updated : 09/23/2021 online version: https://docs.microsoft.com/powershell/module/psreadline/about/about_psreadline?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about PSReadLine --- # about_PSReadLine
-## about_PSReadLine
- ## Short Description PSReadLine provides an improved command-line editing experience in the
PowerShell console.
## Long Description
-PSReadLine 2.2 provides a powerful command-line editing experience for the
+PSReadLine 2.1 provides a powerful command-line editing experience for the
PowerShell console. It provides: - Syntax coloring of the command line
PowerShell console. It provides:
- Many configuration options - Bash style completion (optional in Cmd mode, default in Emacs mode) - Emacs yank/kill-ring-- PowerShell token based "word" movement and kill
+- PowerShell token based "word" movement and deletion
- Predictive IntelliSense
-PSReadLine 2.2.0 added two new predictive IntelliSense features:
+PSReadLine requires PowerShell 3.0, or newer. PSReadLine works with default
+console host, Visual Studio Code, and Window Terminal. It does not work in
+PowerShell ISE.
+
+PSReadLine 2.1.0 ships with PowerShell 7.2 and is supported in all supported
+versions of PowerShell. It is available to install from the PowerShell Gallery.
+To install PSReadLine 2.1.0 in a supported version of PowerShell run the
+following command.
+
+PSReadLine 2.2.0 (beta) added two new predictive IntelliSense features:
- Added the **PredictionViewStyle** parameter to allow for the selection of the new `ListView`.
PSReadLine 2.2.0 added two new predictive IntelliSense features:
allow a user can import a predictor module that can render the suggestions from a custom source.
-PSReadLine requires PowerShell 3.0, or newer. PSReadLine works with default
-console host, Visual Studio Code, and Window Terminal. It does not work in
-PowerShell ISE.
-
-PSReadLine 2.2.0 ships with PowerShell 7.2 and is supported in all supported
-versions of PowerShell. It is available to install from the PowerShell Gallery.
-To install PSReadLine 2.2.0 in a supported version of PowerShell run the
-following command.
```powershell Install-Module -Name PSReadLine -AllowPrerelease
The following functions are available in the class
### Abort
-Abort current action, e.g. incremental history search.
+Abort current action, for example: incremental history search.
- Emacs: `<Ctrl+g>`
then recall the next item from history the next time ReadLine is called.
### AcceptLine Attempt to execute the current input. If the current input is incomplete (for
-example there is a missing closing parenthesis, bracket, or quote, then the
+example there is a missing closing parenthesis, bracket, or quote) then the
continuation prompt is displayed on the next line and PSReadLine waits for keys to edit the current input.
Repeat the last text modification.
### RevertLine
-Reverts all of the input to the current input.
+Reverts all input to the current input.
- Cmd: `<Escape>` - Emacs: `<Alt+r>`, `<Escape,r>`
word to the cursor. The cleared text is placed in the kill-ring.
### ValidateAndAcceptLine Attempt to execute the current input. If the current input is incomplete (for
-example there is a missing closing parenthesis, bracket, or quote, then the
+example there is a missing closing parenthesis, bracket, or quote) then the
continuation prompt is displayed on the next line and PSReadLine waits for keys to edit the current input.
A new line is inserted below the current line.
### ViBackwardDeleteGlob
-Deletes the previous word, using only white space as the word delimiter.
+Deletes the previous word, using only whitespace as the word delimiter.
- Vi command mode: `<d,B>` ### ViBackwardGlob
-Moves the cursor back to the beginning of the previous word, using only white
-space as delimiters.
+Moves the cursor back to the beginning of the previous word, using only
+whitespace as delimiters.
- Vi command mode: `<B>`
Delete to the end of the word.
### ViDeleteGlob
-Delete the next glob (white space delimited word).
+Delete the next glob (whitespace delimited word).
- Vi command mode: `<d,W>`
the cursor to the next line of multi-line input.
### ViEndOfGlob
-Moves the cursor to the end of the word, using only white space as delimiters.
+Moves the cursor to the end of the word, using only whitespace as delimiters.
- Vi command mode: `<E>` ### ViEndOfPreviousGlob
-Moves to the end of the previous word, using only white space as a word
+Moves to the end of the previous word, using only whitespace as a word
delimiter. - Function is unbound.
Similar to GotoBrace, but is character based instead of token based.
### ViNextGlob
-Moves to the next word, using only white space as a word delimiter.
+Moves to the next word, using only whitespace as a word delimiter.
- Vi command mode: `<W>`
Switch the view style for prediction between `InlineView` and `ListView`.
### CaptureScreen Start interactive screen capture - up/down arrows select lines, enter copies
-selected text to clipboard as text and html.
+selected text to clipboard as text and HTML.
- Function is unbound.
Start a new digit argument to pass to other functions.
### InvokePrompt Erases the current prompt and calls the prompt function to redisplay the
-prompt. Useful for custom key handlers that change state, e.g. change the
-current directory.
+prompt. Useful for custom key handlers that change state. For example, change
+the current directory.
- Function is unbound.
You can bind a ScriptBlock to a key. The ScriptBlock can do pretty much
anything you want. Some useful examples include - edit the command line-- opening a new window (e.g. help)
+- opening a new window (for example, help)
- change directories without changing the command line The ScriptBlock receives two arguments:
a custom key binding.
void GetSelectionState([ref] int start, [ref] int length) ```
-If there is no selection on the command line, -1 will be returned in both
+If there is no selection on the command line, the function returns -1 in both
start and length. If there is a selection on the command line, the start and length of the selection are returned.
developer How To Support Jobs https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/developer/cmdlet/how-to-support-jobs.md
information about background jobs, see [Background Jobs](./background-jobs.md).
foreach (Process pl in p) {
- Output.Add(new PSObject(pl));
+ Output.Add(PSObject.AsPSObject(pl));
} Output.Complete(); } // End DoProcessLogic.
information about background jobs, see [Background Jobs](./background-jobs.md).
} else {
- job.ChildJobs[0].Output.Add(new PSObject(pl));
+ job.ChildJobs[0].Output.Add(PSObject.AsPSObject(pl));
} } } // End DoProcessLogic.
namespace Microsoft.Samples.PowerShell.Commands
foreach (Process pl in p) {
- Output.Add(new PSObject(pl));
+ Output.Add(PSObject.AsPSObject(pl));
} Output.Complete(); } // End DoProcessLogic.
namespace Microsoft.Samples.PowerShell.Commands
} else {
- job.ChildJobs[0].Output.Add(new PSObject(pl));
+ job.ChildJobs[0].Output.Add(PSObject.AsPSObject(pl));
} } } // End DoProcessLogic.
install Powershell Support Lifecycle https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md
--- description: Details the policies governing support for PowerShell Previously updated : 09/21/2021 Last updated : 09/23/2021 Title: PowerShell Support Lifecycle --- # PowerShell Support Lifecycle
longer be supported.
| 6.1 | September 28, 2019 | | 6.0 | February 13, 2019 | - Support for PowerShell on a specific platforms is based on the support policy of the version of .NET used.
used.
When a platform version reaches end-of-life as defined by the platform owner, PowerShell also ceases to support that platform version. Previously released packages remain available for customers
-needing access but formal support and updates are no longer be provided.
+needing access but formal support and updates are no longer provided.
So, the distribution owners ended support for the following versions and aren't supported.
Server is supported under the [Windows Support Lifecycle][lifecycle].
[Experimental features][exp] are limited to community support.
-## Security Servicing Criteria
-
-PowerShell follows the [Microsoft Security Servicing Criteria for Windows][mssec].
-The table below outlines the features that meet the servicing criteria and those that do not.
-
-| Feature | Type |
-| ------------------------------------------ | ---------------- |
-| System Lockdown - with WDAC | Security Feature |
-| Constrained language mode - with WDAC | Security Feature |
-| System Lockdown - with AppLocker | Defense in Depth |
-| Constrained language mode - with AppLocker | Defense in Depth |
-| Execution Policy | Defense in Depth |
-
-> [!NOTE]
-> There is a corner-case scenario in AppLocker where you only have **Deny** rules and constrained
-> language mode is not used to enforce the policy that allowed you to bypass the execution policy.
-> Beginning in PowerShell 7.2, a change was made to ensure that AppLocker rules would take
-> precedence over a `Set-ExecutionPolicy -ExecutionPolicy Bypass` command.
-
-For more information about AppLocker and Windows Defender Application Control (WDAC), see
-[Application Controls for Windows][WDAC].
- ## Notes on licensing PowerShell Core is released under the [MIT license][mit]. Under this license, and without a paid
for historical reference. It is not intended for use to determine the support li
[Long-Term]: https://dotnet.microsoft.com/platform/support/policy/dotnet-core [mit]: https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt [modern]: /lifecycle/policies/modern
-[mssec]: https://www.microsoft.com/msrc/windows-security-servicing-criteria
[net31os]: https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-supported-os.md [net50os]: https://github.com/dotnet/core/blob/master/release-notes/5.0/5.0-supported-os.md [net60os]: https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md
for historical reference. It is not intended for use to determine the support li
[pscommunity]: https://techcommunity.microsoft.com/t5/PowerShell/ct-p/WindowsPowerShell [pshub]: /powershell/scripting/community/community-support [semi-annual]: /windows-server/get-started-19/servicing-channels-19
-[WDAC]: /windows/security/threat-protection/windows-defender-application-control/windows-defender-application-control
learn Security Features https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/learn/security-features.md
+---
+description: PowerShell has several features designed to improve the security of your scripting environment.
Last updated : 09/23/2021
+ Title: PowerShell security features
+---
+# PowerShell security features
+
+PowerShell has several features designed to improve the security of your scripting environment.
+
+## Execution policy
+
+PowerShell's execution policy is a safety feature that controls the conditions under which
+PowerShell loads configuration files and runs scripts. This feature helps prevent the execution of
+malicious scripts. You can use a Group Policy setting to set execution policies for computers and
+users. Execution policies only apply to the Windows platform.
+
+For more information see [about_Execution_Policies][exe-policy].
+
+## Module and script block logging
+
+Module Logging allows you to enable logging for selected PowerShell modules. This setting is
+effective in all sessions on the computer. Pipeline execution events for the specified modules
+are recorded in the Windows PowerShell log in Event Viewer.
+
+Script Block Logging enables logging for the processing of commands, script blocks,
+functions, and scripts - whether invoked interactively, or through automation. This information is
+logged to the **Microsoft-Windows-PowerShell/Operational** event log.
+
+For more information, see the following articles:
+
+- [about_Group_Policy_Settings][logging]
+- [about_Logging_Windows][log-win]
+- [about_Logging_Non-Windows][log-unix]
+
+## Constrained language mode
+
+**ConstrainedLanguage** mode protects your system by limiting the cmdlets and .NET types that can be used
+in a PowerShell session. For a full description, see [about_Language_Modes][lang-modes].
+
+## Application Control
+
+Windows 10 includes two technologies, [Windows Defender Application Control (WDAC)][WDAC] and
+[AppLocker][applocker] that can be used for application control. They allow you to create a lockdown
+experience to meet your organization's specific scenarios and requirements.
+
+> [!NOTE]
+> When it comes to [choosing between WDAC or AppLocker][choosing] it is generally recommended that
+> customers implement application control using WDAC rather than AppLocker. WDAC is undergoing
+> continual improvements and will be getting added support from Microsoft management platforms.
+> Although AppLocker will continue to receive security fixes, it will not undergo new feature
+> improvements.
+
+**WDAC** was introduced with Windows 10 and allows organizations to control which drivers and
+applications are allowed to run on their Windows 10 devices. WDAC is designed as a security feature
+under the servicing criteria defined by the Microsoft Security Response Center (MSRC).
+
+**AppLocker** builds on the application control features of Software Restriction Policies.
+AppLocker contains new capabilities and extensions that enable you to create rules to allow or deny
+apps from running based on unique identities of files and to specify which users or groups can run
+those apps.
+
+### Security Servicing Criteria
+
+PowerShell follows the [Microsoft Security Servicing Criteria for Windows][mssec].
+The table below outlines the features that meet the servicing criteria and those that do not.
+
+| Feature | Type |
+| ------------------------------------------ | ---------------- |
+| System Lockdown - with WDAC | Security Feature |
+| Constrained language mode - with WDAC | Security Feature |
+| System Lockdown - with AppLocker | Defense in Depth |
+| Constrained language mode - with AppLocker | Defense in Depth |
+| Execution Policy | Defense in Depth |
+
+> [!NOTE]
+> There is a corner-case scenario in AppLocker where you only have **Deny** rules and constrained
+> language mode is not used to enforce the policy that allows you to bypass the execution policy.
+> Beginning in PowerShell 7.2, a change was made to ensure AppLocker rules take precedence
+> over a `Set-ExecutionPolicy -ExecutionPolicy Bypass` command.
+
+For more information about AppLocker and Windows Defender Application Control (WDAC), see
+[Application Controls for Windows][WDAC] and
+[WDAC and AppLocker feature availability][availability].
+
+<!-- link references -->
+[applocker]: /windows/security/threat-protection/windows-defender-application-control/applocker/what-is-applocker
+[availability]: /windows/security/threat-protection/windows-defender-application-control/feature-availability
+[choosing]: /windows/security/threat-protection/windows-defender-application-control/wdac-and-applocker-overview#choose-when-to-use-wdac-or-applocker
+[exe-policy]: /powershell/module/microsoft.powershell.core/about/about_execution_policies
+[lang-modes]: /powershell/module/microsoft.powershell.core/about/about_language_modes
+[log-unix]: /powershell/module/microsoft.powershell.core/about/about_logging_non-windows
+[log-win]: /powershell/module/microsoft.powershell.core/about/about_logging_windows
+[logging]: /powershell/module/microsoft.powershell.core/about/about_group_policy_settings#turn-on-module-logging
+[mssec]: https://www.microsoft.com/msrc/windows-security-servicing-criteria
+[WDAC]: /windows/security/threat-protection/windows-defender-application-control/windows-defender-application-control