From d8537a079a1edc375a94df1836370023c730f151 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Sun, 18 Jan 2026 15:02:31 -0600 Subject: [PATCH 1/3] Standardize scriptblock and statement terminology --- .../CimCmdlets/Register-CimIndicationEvent.md | 22 ++--- .../Microsoft.PowerShell.Core/About/About.md | 13 ++- .../About/about_Arrays.md | 23 +++-- .../About/about_Automatic_Variables.md | 30 +++---- .../About/about_Break.md | 14 ++- .../About/about_Calculated_Properties.md | 26 +++--- .../About/about_Command_Precedence.md | 12 ++- .../About/about_CommonParameters.md | 15 ++-- .../About/about_Comparison_Operators.md | 10 +-- .../About/about_Continue.md | 12 ++- .../About/about_Do.md | 54 +++++++----- .../About/about_Foreach.md | 2 +- .../About/about_Format.ps1xml.md | 6 +- .../About/about_Function_Provider.md | 6 +- .../About/about_Functions.md | 21 +++-- .../About/about_Functions_Advanced_Methods.md | 4 +- .../about_Functions_Advanced_Parameters.md | 13 ++- .../about_Functions_Argument_Completion.md | 16 ++-- .../About/about_Group_Policy_Settings.md | 8 +- .../About/about_Language_Modes.md | 4 +- .../About/about_Object_Creation.md | 4 +- .../About/about_Operators.md | 32 +++---- .../About/about_Parameters.md | 10 +-- .../About/about_Parameters_Default_Values.md | 12 +-- .../About/about_Parsing.md | 4 +- .../About/about_Ref.md | 12 +-- .../About/about_Return.md | 10 +-- .../About/about_Script_Blocks.md | 79 ++++++++--------- .../about_Session_Configuration_Files.md | 4 +- .../About/about_Simplified_Syntax.md | 10 +-- .../About/about_Splatting.md | 15 ++-- .../About/about_Split.md | 8 +- .../About/about_Switch.md | 29 +++---- .../About/about_Throw.md | 6 +- .../About/about_Types.ps1xml.md | 14 +-- .../About/about_Updatable_Help.md | 4 +- .../About/about_Wildcards.md | 5 +- .../Microsoft.PowerShell.Core/Add-History.md | 15 ++-- .../ForEach-Object.md | 46 +++++----- .../Microsoft.PowerShell.Core/Get-Command.md | 6 +- .../Invoke-Command.md | 37 ++++---- .../Microsoft.PowerShell.Core.md | 4 +- .../Microsoft.PowerShell.Core/New-Module.md | 24 +++--- .../New-PSRoleCapabilityFile.md | 4 +- .../New-PSSessionConfigurationFile.md | 15 ++-- .../Register-ArgumentCompleter.md | 31 ++++--- .../Remove-Module.md | 10 +-- .../Set-StrictMode.md | 6 +- .../Microsoft.PowerShell.Core/Start-Job.md | 13 ++- .../Microsoft.PowerShell.Core/Where-Object.md | 20 ++--- .../Get-Counter.md | 18 ++-- .../Get-WinEvent.md | 14 ++- .../Get-Content.md | 8 +- .../Rename-Item.md | 28 +++--- .../Add-Member.md | 37 +++++--- .../Compare-Object.md | 7 +- .../ConvertTo-Html.md | 7 +- .../Export-FormatData.md | 37 ++++---- .../Export-PSSession.md | 9 +- .../Format-Custom.md | 15 ++-- .../Format-List.md | 26 +++--- .../Format-Table.md | 47 +++++----- .../Format-Wide.md | 11 ++- .../Get-Member.md | 5 +- .../Get-TypeData.md | 13 ++- .../Group-Object.md | 9 +- .../Import-PSSession.md | 5 +- .../Measure-Command.md | 21 +++-- .../Measure-Object.md | 3 +- .../Microsoft.PowerShell.Utility.md | 14 +-- .../Out-GridView.md | 4 +- .../Register-EngineEvent.md | 9 +- .../Register-ObjectEvent.md | 12 +-- .../Select-Object.md | 5 +- .../Set-PSBreakpoint.md | 13 ++- .../Sort-Object.md | 14 +-- .../Update-TypeData.md | 9 +- .../Write-Progress.md | 12 +-- .../About/about_PSReadLine_Functions.md | 2 +- .../About/about_PSReadLine_Release_Notes.md | 2 +- .../PSReadLine/Set-PSReadLineKeyHandler.md | 13 ++- .../5.1/PSReadLine/Set-PSReadLineOption.md | 10 +-- .../CimCmdlets/Register-CimIndicationEvent.md | 22 ++--- .../Microsoft.PowerShell.Core/About/About.md | 15 ++-- .../About/about_Arrays.md | 23 +++-- .../About/about_Automatic_Variables.md | 30 +++---- .../About/about_Break.md | 14 ++- .../About/about_Calculated_Properties.md | 30 +++---- .../About/about_Command_Precedence.md | 12 ++- .../About/about_CommonParameters.md | 15 ++-- .../About/about_Comparison_Operators.md | 20 ++--- .../About/about_Continue.md | 12 ++- .../About/about_Do.md | 54 +++++++----- .../About/about_Foreach.md | 4 +- .../About/about_Format.ps1xml.md | 9 +- .../About/about_Function_Provider.md | 6 +- .../About/about_Functions.md | 25 +++--- .../About/about_Functions_Advanced_Methods.md | 7 +- .../about_Functions_Advanced_Parameters.md | 13 ++- .../about_Functions_Argument_Completion.md | 18 ++-- .../About/about_Group_Policy_Settings.md | 8 +- .../About/about_Language_Modes.md | 4 +- .../About/about_Logging_Non-Windows.md | 7 +- .../About/about_Logging_Windows.md | 13 ++- .../About/about_Object_Creation.md | 4 +- .../About/about_Operators.md | 8 +- .../About/about_Parameters.md | 10 +-- .../About/about_Parameters_Default_Values.md | 12 +-- .../About/about_Parsing.md | 4 +- .../About/about_PowerShell_Config.md | 6 +- .../About/about_Pwsh.md | 20 ++--- .../About/about_Ref.md | 12 +-- .../About/about_Return.md | 10 +-- .../About/about_Script_Blocks.md | 79 ++++++++--------- .../about_Session_Configuration_Files.md | 4 +- .../About/about_Simplified_Syntax.md | 10 +-- .../About/about_Splatting.md | 15 ++-- .../About/about_Split.md | 8 +- .../About/about_Switch.md | 26 +++--- .../About/about_Thread_Jobs.md | 11 ++- .../About/about_Throw.md | 6 +- .../About/about_Types.ps1xml.md | 14 +-- .../About/about_Updatable_Help.md | 4 +- .../About/about_Wildcards.md | 5 +- .../Microsoft.PowerShell.Core/Add-History.md | 15 ++-- .../ForEach-Object.md | 86 +++++++++---------- .../Microsoft.PowerShell.Core/Get-Command.md | 6 +- .../Invoke-Command.md | 39 ++++----- .../Microsoft.PowerShell.Core.md | 4 +- .../Microsoft.PowerShell.Core/New-Module.md | 25 +++--- .../New-PSRoleCapabilityFile.md | 4 +- .../New-PSSessionConfigurationFile.md | 31 ++++--- .../Register-ArgumentCompleter.md | 31 ++++--- .../Remove-Module.md | 10 +-- .../Set-StrictMode.md | 6 +- .../Microsoft.PowerShell.Core/Start-Job.md | 24 +++--- .../Microsoft.PowerShell.Core/Where-Object.md | 20 ++--- .../Get-Counter.md | 14 +-- .../Get-WinEvent.md | 14 ++- .../Get-Content.md | 23 ++--- .../Rename-Item.md | 27 +++--- .../Add-Member.md | 37 +++++--- .../Compare-Object.md | 7 +- .../ConvertTo-Html.md | 7 +- .../Export-FormatData.md | 35 ++++---- .../Export-PSSession.md | 43 ++++++++-- .../Format-Custom.md | 11 ++- .../Format-List.md | 26 +++--- .../Format-Table.md | 47 +++++----- .../Format-Wide.md | 11 ++- .../Get-Member.md | 5 +- .../Get-TypeData.md | 13 ++- .../Group-Object.md | 11 ++- .../Import-PSSession.md | 5 +- .../Join-String.md | 7 +- .../Measure-Command.md | 21 +++-- .../Measure-Object.md | 15 ++-- .../Microsoft.PowerShell.Utility.md | 8 +- .../Out-GridView.md | 6 +- .../Register-EngineEvent.md | 9 +- .../Register-ObjectEvent.md | 10 +-- .../Remove-Alias.md | 5 +- .../Select-Object.md | 13 ++- .../Set-PSBreakpoint.md | 13 ++- .../Sort-Object.md | 7 +- .../Update-TypeData.md | 9 +- .../Write-Progress.md | 5 +- .../About/about_PSReadLine_Functions.md | 11 ++- .../About/about_PSReadLine_Release_Notes.md | 4 +- .../PSReadLine/Set-PSReadLineKeyHandler.md | 13 ++- .../7.4/PSReadLine/Set-PSReadLineOption.md | 11 ++- reference/7.4/ThreadJob/Start-ThreadJob.md | 14 +-- .../CimCmdlets/Register-CimIndicationEvent.md | 16 ++-- .../Microsoft.PowerShell.Core/About/About.md | 7 +- .../About/about_Arrays.md | 30 +++++-- .../About/about_Automatic_Variables.md | 39 ++++++--- .../About/about_Break.md | 7 +- .../About/about_Calculated_Properties.md | 23 ++--- .../About/about_Command_Precedence.md | 5 +- .../About/about_CommonParameters.md | 23 ++++- .../About/about_Comparison_Operators.md | 13 +-- .../About/about_Continue.md | 5 +- .../About/about_Do.md | 54 +++++++----- .../About/about_Foreach.md | 4 +- .../About/about_Format.ps1xml.md | 9 +- .../About/about_Function_Provider.md | 6 +- .../About/about_Functions.md | 25 +++--- .../About/about_Functions_Advanced_Methods.md | 7 +- .../about_Functions_Advanced_Parameters.md | 13 ++- .../about_Functions_Argument_Completion.md | 16 ++-- .../About/about_Group_Policy_Settings.md | 8 +- .../About/about_Language_Modes.md | 4 +- .../About/about_Logging_Non-Windows.md | 7 +- .../About/about_Logging_Windows.md | 13 ++- .../About/about_Object_Creation.md | 4 +- .../About/about_Operators.md | 8 +- .../About/about_Parameters.md | 10 +-- .../About/about_Parameters_Default_Values.md | 12 +-- .../About/about_Parsing.md | 4 +- .../About/about_PowerShell_Config.md | 6 +- .../About/about_Pwsh.md | 20 ++--- .../About/about_Ref.md | 12 +-- .../About/about_Return.md | 10 +-- .../About/about_Script_Blocks.md | 79 ++++++++--------- .../about_Session_Configuration_Files.md | 4 +- .../About/about_Simplified_Syntax.md | 10 +-- .../About/about_Splatting.md | 15 ++-- .../About/about_Split.md | 8 +- .../About/about_Switch.md | 24 +++--- .../About/about_Thread_Jobs.md | 11 ++- .../About/about_Throw.md | 6 +- .../About/about_Types.ps1xml.md | 14 +-- .../About/about_Updatable_Help.md | 4 +- .../About/about_Wildcards.md | 5 +- .../Microsoft.PowerShell.Core/Add-History.md | 12 +-- .../ForEach-Object.md | 86 +++++++++---------- .../Microsoft.PowerShell.Core/Get-Command.md | 6 +- .../Invoke-Command.md | 77 ++++++++--------- .../Microsoft.PowerShell.Core.md | 4 +- .../Microsoft.PowerShell.Core/New-Module.md | 27 +++--- .../New-PSRoleCapabilityFile.md | 4 +- .../New-PSSessionConfigurationFile.md | 17 ++-- .../Register-ArgumentCompleter.md | 41 +++++---- .../Remove-Module.md | 10 +-- .../Set-StrictMode.md | 8 +- .../Microsoft.PowerShell.Core/Start-Job.md | 34 ++++---- .../Microsoft.PowerShell.Core/Where-Object.md | 20 ++--- .../Get-Counter.md | 4 +- .../Get-WinEvent.md | 14 ++- .../Get-Content.md | 5 +- .../Rename-Item.md | 13 ++- .../Add-Member.md | 15 ++-- .../Compare-Object.md | 7 +- .../ConvertTo-Html.md | 13 ++- .../Export-FormatData.md | 15 ++-- .../Export-PSSession.md | 11 ++- .../Format-Custom.md | 12 +-- .../Format-List.md | 9 +- .../Format-Table.md | 15 ++-- .../Format-Wide.md | 17 ++-- .../Get-Member.md | 5 +- .../Get-TypeData.md | 13 ++- .../Group-Object.md | 11 ++- .../Import-PSSession.md | 5 +- .../Join-String.md | 7 +- .../Measure-Command.md | 21 +++-- .../Measure-Object.md | 5 +- .../Microsoft.PowerShell.Utility.md | 8 +- .../Out-GridView.md | 6 +- .../Register-EngineEvent.md | 9 +- .../Register-ObjectEvent.md | 12 +-- .../Remove-Alias.md | 5 +- .../Select-Object.md | 13 ++- .../Set-PSBreakpoint.md | 22 +++-- .../Sort-Object.md | 7 +- .../Update-TypeData.md | 9 +- .../Write-Progress.md | 5 +- .../About/about_PSReadLine_Functions.md | 8 +- .../About/about_PSReadLine_Release_Notes.md | 4 +- .../PSReadLine/Set-PSReadLineKeyHandler.md | 13 ++- .../7.5/PSReadLine/Set-PSReadLineOption.md | 11 ++- reference/7.5/ThreadJob/Start-ThreadJob.md | 14 +-- .../CimCmdlets/Register-CimIndicationEvent.md | 16 ++-- .../Microsoft.PowerShell.Core/About/About.md | 9 +- .../About/about_Arrays.md | 30 +++++-- .../About/about_Automatic_Variables.md | 39 ++++++--- .../About/about_Break.md | 7 +- .../About/about_Calculated_Properties.md | 23 ++--- .../About/about_Command_Precedence.md | 5 +- .../About/about_CommonParameters.md | 23 ++++- .../About/about_Comparison_Operators.md | 13 +-- .../About/about_Continue.md | 5 +- .../About/about_Do.md | 54 +++++++----- .../About/about_Foreach.md | 4 +- .../About/about_Format.ps1xml.md | 11 ++- .../About/about_Function_Provider.md | 6 +- .../About/about_Functions.md | 25 +++--- .../About/about_Functions_Advanced_Methods.md | 7 +- .../about_Functions_Advanced_Parameters.md | 13 ++- .../about_Functions_Argument_Completion.md | 16 ++-- .../About/about_Group_Policy_Settings.md | 8 +- .../About/about_Language_Modes.md | 4 +- .../About/about_Logging_Non-Windows.md | 7 +- .../About/about_Logging_Windows.md | 13 ++- .../About/about_Object_Creation.md | 4 +- .../About/about_Operators.md | 8 +- .../About/about_Parameters.md | 10 +-- .../About/about_Parameters_Default_Values.md | 12 +-- .../About/about_Parsing.md | 4 +- .../About/about_PowerShell_Config.md | 6 +- .../About/about_Pwsh.md | 20 ++--- .../About/about_Ref.md | 12 +-- .../About/about_Return.md | 10 +-- .../About/about_Script_Blocks.md | 79 ++++++++--------- .../about_Session_Configuration_Files.md | 4 +- .../About/about_Simplified_Syntax.md | 10 +-- .../About/about_Splatting.md | 15 ++-- .../About/about_Split.md | 8 +- .../About/about_Switch.md | 24 +++--- .../About/about_Thread_Jobs.md | 11 ++- .../About/about_Throw.md | 6 +- .../About/about_Types.ps1xml.md | 14 +-- .../About/about_Updatable_Help.md | 4 +- .../About/about_Wildcards.md | 5 +- .../Microsoft.PowerShell.Core/Add-History.md | 15 ++-- .../ForEach-Object.md | 86 +++++++++---------- .../Microsoft.PowerShell.Core/Get-Command.md | 6 +- .../Invoke-Command.md | 39 ++++----- .../Microsoft.PowerShell.Core.md | 4 +- .../Microsoft.PowerShell.Core/New-Module.md | 24 +++--- .../New-PSRoleCapabilityFile.md | 4 +- .../New-PSSessionConfigurationFile.md | 31 ++++--- .../Register-ArgumentCompleter.md | 31 ++++--- .../Remove-Module.md | 10 +-- .../Set-StrictMode.md | 6 +- .../Microsoft.PowerShell.Core/Start-Job.md | 24 +++--- .../Microsoft.PowerShell.Core/Where-Object.md | 20 ++--- .../Get-Counter.md | 14 +-- .../Get-WinEvent.md | 14 ++- .../Get-Content.md | 21 +++-- .../Rename-Item.md | 27 +++--- .../Add-Member.md | 37 +++++--- .../Compare-Object.md | 7 +- .../ConvertTo-Html.md | 7 +- .../Export-FormatData.md | 35 ++++---- .../Export-PSSession.md | 43 ++++++++-- .../Format-Custom.md | 11 ++- .../Format-List.md | 26 +++--- .../Format-Table.md | 47 +++++----- .../Format-Wide.md | 11 ++- .../Get-Member.md | 5 +- .../Get-TypeData.md | 13 ++- .../Group-Object.md | 11 ++- .../Import-PSSession.md | 5 +- .../Join-String.md | 7 +- .../Measure-Command.md | 21 +++-- .../Measure-Object.md | 5 +- .../Microsoft.PowerShell.Utility.md | 8 +- .../Out-GridView.md | 6 +- .../Register-EngineEvent.md | 9 +- .../Register-ObjectEvent.md | 12 +-- .../Remove-Alias.md | 5 +- .../Select-Object.md | 13 ++- .../Set-PSBreakpoint.md | 22 +++-- .../Sort-Object.md | 7 +- .../Update-TypeData.md | 9 +- .../Write-Progress.md | 5 +- .../About/about_PSReadLine_Functions.md | 8 +- .../About/about_PSReadLine_Release_Notes.md | 4 +- .../PSReadLine/Set-PSReadLineKeyHandler.md | 13 ++- .../7.6/PSReadLine/Set-PSReadLineOption.md | 11 ++- reference/7.6/ThreadJob/Start-ThreadJob.md | 14 +-- .../learn/deep-dives/everything-about-if.md | 21 ++--- .../deep-dives/everything-about-switch.md | 9 +- 354 files changed, 2777 insertions(+), 2665 deletions(-) diff --git a/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md b/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md index a84ba0372451..ea38579729be 100644 --- a/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md +++ b/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md @@ -1,14 +1,5 @@ --- -external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml -Locale: en-US -Module Name: CimCmdlets -ms.date: 01/16/2026 -no-loc: [-Forward] -online version: https://learn.microsoft.com/powershell/module/cimcmdlets/register-cimindicationevent?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -aliases: - - rcie -title: Register-CimIndicationEvent +ms.date: 01/18/2026 --- # Register-CimIndicationEvent @@ -96,7 +87,7 @@ Register-CimIndicationEvent -Query $query -SourceIdentifier "Timer" ### Example 3: Run a script when the event arrives This example shows how to use an action in response to an event. The variable `$action` holds the -script block for **Action**, which uses the `$Event` variable to access the event received from CIM. +scriptblock for **Action**, which uses the `$Event` variable to access the event received from CIM. ```powershell $action = { @@ -137,11 +128,11 @@ Get-Event -SourceIdentifier "ProcessStarted" Specifies the commands that handle the events. The commands specified by this parameter run when an event is raised, instead of sending the event to the event queue. Enclose the commands in braces -(`{}`) to create a script block. +(`{}`) to create a scriptblock. -The script block specified with **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, +The scriptblock specified with **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$SourceEventArgs`, and `$SourceArgs` automatic variables, which provide information about the event -to the **Action** script block. For more information, see +to the **Action** scriptblock. For more information, see [About Automatic Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```yaml @@ -419,3 +410,6 @@ This cmdlet returns an **EventSubscription** object. [New-CimSession](New-CimSession.md) [about_WQL](../Microsoft.PowerShell.Core/About/about_WQL.md) + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/About.md b/reference/5.1/Microsoft.PowerShell.Core/About/About.md index 99e072af3e03..a81de8134f92 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/About.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/About.md @@ -1,9 +1,5 @@ --- -description: About topics cover a range of concepts about PowerShell. -Help Version: 6.0 -Locale: en-US -ms.date: 04/01/2025 -title: About topics +ms.date: 01/18/2026 --- # About topics @@ -496,7 +492,7 @@ special meaning in PowerShell. ### [about_Return](about_Return.md) -Exits the current scope, which can be a function, script, or script block. +Exits the current scope, which can be a function, script, or scriptblock. ### [about_Run_With_PowerShell](about_Run_With_PowerShell.md) @@ -510,7 +506,7 @@ scope of elements. ### [about_Script_Blocks](about_Script_Blocks.md) -Defines what a script block is and explains how to use script blocks in the +Defines what a scriptblock is and explains how to use scriptblocks in the PowerShell programming language. ### [about_Script_Internationalization](about_Script_Internationalization.md) @@ -655,3 +651,6 @@ manageable components of the modern enterprise. Describes WMI Query Language (WQL), which can be used to get WMI objects in Windows PowerShell. + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md index b1a34f2c5b77..8cc3d533baee 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1,11 +1,5 @@ --- -description: Describes arrays, which are data structures designed to store collections of items. -Locale: en-US -ms.date: 01/03/2025 -no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Arrays +ms.date: 01/18/2026 --- # about_Arrays @@ -522,7 +516,7 @@ ForEach(string methodName, object[] arguments) This method was added in PowerShell v4. > [!NOTE] -> The syntax requires the usage of a script block. Parentheses are optional if +> The syntax requires the usage of a scriptblock. Parentheses are optional if > the scriptblock is the only parameter. Also, there must not be a space > between the method and the opening parenthesis or brace. @@ -542,7 +536,7 @@ $a.ForEach({ $_ * $_}) ``` Just like the **ArgumentList** parameter of `ForEach-Object`, the `arguments` -parameter allows the passing of an array of arguments to a script block +parameter allows the passing of an array of arguments to a scriptblock configured to accept them. For more information about the behavior of **ArgumentList**, see @@ -601,7 +595,7 @@ THREE ``` Just like the **ArgumentList** parameter of `ForEach-Object`, the `arguments` -parameter allows the passing of an array of values to a script block configured +parameter allows the passing of an array of values to a scriptblock configured to accept them. > [!NOTE] @@ -625,7 +619,7 @@ Where(scriptblock expression[, WhereOperatorSelectionMode mode ``` > [!NOTE] -> The syntax requires the usage of a script block. Parentheses are optional if +> The syntax requires the usage of a scriptblock. Parentheses are optional if > the scriptblock is the only parameter. Also, there must not be a space > between the method and the opening parenthesis or brace. @@ -701,7 +695,7 @@ $logs.Where({$_.CreationTime -gt $h}, 'Last', 5) #### SkipUntil The `SkipUntil` mode skips all objects in a collection until an object passes -the script block expression filter. It then returns **ALL** remaining +the scriptblock expression filter. It then returns **ALL** remaining collection items without testing them. _Only one passing item is tested_. This means the returned collection contains both _passing_ and @@ -723,7 +717,7 @@ localhost #### Until The `Until` mode inverts the `SkipUntil` mode. It returns **ALL** items in a -collection until an item passes the script block expression. Once an item +collection until an item passes the scriptblock expression. Once an item _passes_ the scriptblock expression, the `Where()` method stops processing items. @@ -1115,3 +1109,6 @@ LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;} [12]: about_Splatting.md#splatting-with-arrays [13]: about_While.md [14]: https://wikipedia.org/wiki/Row-_and_column-major_order + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index b24d3861b4de..629fc27b5fcf 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -1,13 +1,6 @@ --- -description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell. -Locale: en-US -ms.date: 01/07/2025 -no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline, PSEventArgs, PSEventSubscriber, PSEdition] -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Automatic_Variables +ms.date: 01/18/2026 --- - # about_Automatic_Variables ## Short description @@ -135,7 +128,7 @@ For more information, see [about_PSItem][67]. ### `$args` Contains an array of values for undeclared parameters that are passed to a -function, script, or script block. When you create a function, you can declare +function, script, or scriptblock. When you create a function, you can declare the parameters with the `param` keyword or by adding a comma-separated list of parameters in parentheses after the function name. @@ -172,7 +165,7 @@ processed. This variable is populated only within the `Action` block of an event registration command, such as `Register-ObjectEvent`. The value of this variable is the same object that the `Get-Event` cmdlet returns. You can use the properties of the `Event` variable, such as `$Event.TimeGenerated`, in an -`Action` script block. +`Action` scriptblock. ### `$EventArgs` @@ -232,8 +225,8 @@ display or change the properties of the host, such as `$Host.Version` or ### `$input` Contains an enumerator that enumerates all input that's passed to a function. -The `$input` variable is available only to functions, script blocks (which -are unnamed functions), and script files (which are saved script blocks). +The `$input` variable is available only to functions, scriptblocks (which +are unnamed functions), and script files (which are saved scriptblocks). - In a function without a `begin`, `process`, or `end` block, the `$input` variable enumerates the collection of all input to the function. @@ -248,7 +241,7 @@ are unnamed functions), and script files (which are saved script blocks). > [!NOTE] > You can't use the `$input` variable inside both the `process` block and the - > `end` block in the same function or script block. + > `end` block in the same function or scriptblock. Since `$input` is an enumerator, accessing any of its properties causes `$input` to no longer be available. You can store `$input` in another variable @@ -336,7 +329,7 @@ Contains information about the current command, such as the name, parameters, parameter values, and information about how the command was started, called, or invoked, such as the name of the script that called the current command. -`$MyInvocation` is populated only for scripts, function, and script blocks. You +`$MyInvocation` is populated only for scripts, function, and scriptblocks. You can use the information in the **System.Management.Automation.InvocationInfo** object that `$MyInvocation` returns in the current script, such as the name of a function (`$MyInvocation.MyCommand.Name`) to identify the current command. @@ -650,11 +643,11 @@ and change the current loop iteration. For more information, see ### `$this` -The `$this` variable is used in script blocks that extend classes to refer to +The `$this` variable is used in scriptblocks that extend classes to refer to the instance of the class itself. PowerShell's Extensible Type System (ETS) allows you to add properties to -classes using script blocks. In a script block that defines a script property +classes using scriptblocks. In a scriptblock that defines a script property or script method, the `$this` variable refers to an instance of object of the class that's being extended. For example, PowerShell uses ETS to add the **BaseName** property to the **FileInfo** class. @@ -676,7 +669,7 @@ In a PowerShell class, the `$this` variable refers to the instance object of the class itself, allowing access to properties and methods defined in the class. For more information, see [about_Classes][52]. -The `$this` variable is also used by .NET event classes that take script blocks +The `$this` variable is also used by .NET event classes that take scriptblocks as delegates for the event handler. In this scenario, `$this` represents the object originating the event, known as the event sender. @@ -1115,3 +1108,6 @@ Default (Current): End [75]: xref:System.Collections.IEnumerator.Current [76]: xref:System.Collections.IEnumerator.MoveNext [77]: xref:System.Collections.IEnumerator.Reset + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md index 62562c24326a..c20c9ef08709 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md @@ -1,10 +1,5 @@ --- -description: Describes a statement you can use to immediately exit `foreach`, `for`, `while`, `do`, `switch`, or `trap` statements. -Locale: en-US -ms.date: 04/29/2025 -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_break?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Break +ms.date: 01/18/2026 --- # about_Break @@ -219,8 +214,8 @@ This means that functions and scripts that inadvertently use a `break` outside of an enclosing construct that supports it can inadvertently terminate their _callers_. -Using `break` inside a pipeline `break`, such as a `ForEach-Object` script -block, not only exits the pipeline, it potentially terminates the entire +Using `break` inside a pipeline `break`, such as a `ForEach-Object` +scriptblock, not only exits the pipeline, it potentially terminates the entire runspace. ## See also @@ -234,3 +229,6 @@ runspace. - [about_Trap](about_Trap.md) - [about_Try_Catch_Finally](about_Try_Catch_Finally.md) - [about_While](about_While.md) + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md index 548cfaf7c077..eebba4f7bb56 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md @@ -1,10 +1,5 @@ --- -description: PowerShell provides the ability to dynamically add new properties and alter the formatting of objects output to the pipeline. -Locale: en-US -ms.date: 01/13/2026 -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_calculated_properties?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Calculated_Properties +ms.date: 01/18/2026 --- # about_Calculated_Properties @@ -72,7 +67,7 @@ the key-value pairs that each cmdlet supports. - `Expression` - `Measure-Object` - - Only supports a script block for the expression, not a hashtable. + - Only supports a scriptblock for the expression, not a hashtable. - Not supported in PowerShell 5.1 and older. - `Select-Object` @@ -84,14 +79,14 @@ the key-value pairs that each cmdlet supports. - `Ascending`/`Descending` - optional > [!NOTE] -> The value of the `Expression` can be a script block instead of a +> The value of the `Expression` can be a scriptblock instead of a > hashtable. For more information, see the [Notes][02] section. ## Hashtable key definitions - `Name`/`Label` - Specifies the name of the property being created. You can use `Name` or its alias, `Label`, interchangeably. -- `Expression` - A string or script block used to calculate the value of the +- `Expression` - A string or scriptblock used to calculate the value of the new property. If the `Expression` is a string, the value is interpreted as a property name on the input object. This is a shorter option than `Expression = { $_. }`. @@ -449,7 +444,7 @@ Date Salesperson UnitsSold ## Notes -- You may specify the expression script block _directly_, as an argument, +- You may specify the expression scriptblock _directly_, as an argument, rather than specifying it as the `Expression` entry in a hashtable. For example: @@ -461,17 +456,17 @@ Date Salesperson UnitsSold naming a property via the `Name` key, such as `Sort-Object`, `Group-Object`, and `Measure-Object`. - For cmdlets that support naming the property, the script block is converted + For cmdlets that support naming the property, the scriptblock is converted to a string and used as the name of the property in the output. -- `Expression` script blocks run in _child_ scopes, meaning that the caller's +- `Expression` scriptblocks run in _child_ scopes, meaning that the caller's variables can't be directly modified. -- Pipeline logic is applied to the output from `Expression` script blocks. This +- Pipeline logic is applied to the output from `Expression` scriptblocks. This means that outputting a single-element array causes that array to be unwrapped. -- For most cmdlets, errors inside expression script blocks are quietly ignored. +- For most cmdlets, errors inside expression scriptblocks are quietly ignored. For `Sort-Object`, statement-terminating and script-terminating errors are _output_ but they don't terminate the statement. @@ -504,3 +499,6 @@ Date Salesperson UnitsSold [11]: xref:Microsoft.PowerShell.Utility.Measure-Object [12]: xref:Microsoft.PowerShell.Utility.Select-Object [13]: xref:Microsoft.PowerShell.Utility.Sort-Object + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md index 7497ad797d47..b2ffc7b71572 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md @@ -1,10 +1,5 @@ --- -description: Describes how PowerShell determines which command to run. -Locale: en-US -ms.date: 03/05/2024 -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Command_Precedence +ms.date: 01/18/2026 --- # about_Command_Precedence @@ -225,7 +220,7 @@ You can also use the call operator (`&`) to run hidden commands by combining it with a call to [Get-ChildItem][13] (the alias is `dir`), `Get-Command` or [Get-Module][11]. -The call operator executes strings and script blocks in a child scope. For more +The call operator executes strings and scriptblocks in a child scope. For more information, see [about_Operators][08]. For example, use the following command to run the function named `Map` that's @@ -341,3 +336,6 @@ you must add the extension to the `$Env:PATHEXT` environment variable. [13]: xref:Microsoft.PowerShell.Management.Get-ChildItem [14]: xref:Microsoft.PowerShell.Utility.Get-Date [15]: xref:Microsoft.PowerShell.Utility.Import-PSSession + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md index 36fcd4804ab1..e2734b8083e2 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md @@ -1,11 +1,5 @@ --- -description: Describes the parameters that can be used with any cmdlet. -Locale: en-US -ms.date: 01/12/2026 -no-loc: [Confirm, Debug, ErrorAction, ErrorVariable, InformationAction, InformationVariable, OutBuffer, OutVariable, PipelineVariable, ProgressAction, Verbose, WarningAction, WarningVariable, WhatIf] -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 -title: about_CommonParameters +ms.date: 01/18/2026 --- # about_CommonParameters @@ -384,9 +378,9 @@ piped from while processing the next item passing through the pipeline. This allows a command to _feed back_ its output to a previous command (or itself). >[!NOTE] -> Advanced functions can have up to three script blocks: `begin`, `process`, +> Advanced functions can have up to three scriptblocks: `begin`, `process`, > and `end`. When using the `PipelineVariable` parameter with advanced -> functions, only values from the first defined script block are assigned to +> functions, only values from the first defined scriptblock are assigned to > the variable as the function runs. For more information, see > [Advanced functions][05]. PowerShell 7.2 corrects this behavior. @@ -844,3 +838,6 @@ Mode LastWriteTime Length Name [12]: xref:Microsoft.PowerShell.Utility.Write-Error [13]: xref:Microsoft.PowerShell.Utility.Write-Verbose [14]: xref:Microsoft.PowerShell.Utility.Write-Warning + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index 21d733b1a9d6..506155c7b2de 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -1,10 +1,5 @@ --- -description: Describes the operators that compare values in PowerShell. -Locale: en-US -ms.date: 06/20/2025 -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Comparison_Operators +ms.date: 01/18/2026 --- # about_Comparison_Operators @@ -780,3 +775,6 @@ $a -isnot $b.GetType() # Output: True [13]: xref:Microsoft.PowerShell.Core.Where-Object [14]: xref:Microsoft.PowerShell.Utility.Compare-Object [15]: /powershell/scripting/learn/glossary#scalar-value + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md index 63807a23ccc1..8c300250e86f 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md @@ -1,10 +1,5 @@ --- -description: Describes how the `continue` statement immediately returns the program flow to the top of a program loop, a `switch` statement, or a `trap` statement. -Locale: en-US -ms.date: 06/04/2020 -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_continue?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Continue +ms.date: 01/18/2026 --- # about_Continue @@ -125,7 +120,7 @@ This means that functions and scripts that inadvertently use a `continue` outside of an enclosing construct that supports it, can inadvertently terminate their _callers_. -Using `continue` inside a pipeline, such as a `ForEach-Object` script block, +Using `continue` inside a pipeline, such as a `ForEach-Object` scriptblock, not only exits the pipeline, it potentially terminates the entire runspace. ## See also @@ -136,3 +131,6 @@ not only exits the pipeline, it potentially terminates the entire runspace. - [about_Throw](about_Throw.md) - [about_Trap](about_Trap.md) - [about_Try_Catch_Finally](about_Try_Catch_Finally.md) + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md index 79ad69c91859..c50dc71652fe 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md @@ -1,7 +1,7 @@ --- description: Runs a statement list one or more times, subject to a `while` or `until` condition. Locale: en-US -ms.date: 06/10/2021 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_do?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Do @@ -16,29 +16,29 @@ condition. ## Long description The `do` keyword works with the `while` keyword or the `until` keyword to run -the statements in a script block, subject to a condition. Unlike the related -`while` loop, the script block in a `do` loop always runs at least once. +the commands in a statement block, subject to a condition. Unlike the related +`while` loop, the statement block in a `do` loop always runs at least once. -A **Do-While** loop is a variety of the `while` loop. In a **Do-While** loop, -the condition is evaluated after the script block has run. As in a `while` -loop, the script block is repeated as long as the condition evaluates to true. +A `do/while` loop is a variety of the `while` loop. In a `do/while` loop, the +condition is evaluated after the statement block has run. As in a `while` loop, +the statement block is repeated as long as the condition evaluates to true. -Like a **Do-While** loop, a **Do-Until** loop always runs at least once -before the condition is evaluated. However, the script block runs only -while the condition is false. +Like a `do/while` loop, a `do/until` loop always runs at least once before the +condition is evaluated. However, the statement block runs only while the +condition is false. -The `continue` and `break` flow control keywords can be used in a **Do-While** -loop or in a **Do-Until** loop. +The `continue` and `break` flow control keywords can be used in a `do/while` +loop or in a `do/until` loop. ### Syntax -The following shows the syntax of the **Do-While** statement: +The following shows the syntax of the `do/while` statement: ```powershell do {} while () ``` -The following shows the syntax of the **Do-Until** statement: +The following shows the syntax of the `do/until` statement: ```powershell do {} until () @@ -49,7 +49,7 @@ is entered or repeated. The condition portion of the statement resolves to true or false. For more information about how booleans are evaluated, see -[about_Booleans](about_Booleans.md). +[about_Booleans][02]. ### Example @@ -86,10 +86,22 @@ while (++$a -lt 10) ## See also -- [about_Booleans](about_Booleans.md) -- [about_Break](about_Break.md) -- [about_Continue](about_Continue.md) -- [about_Operators](about_Operators.md) -- [about_Assignment_Operators](about_Assignment_Operators.md) -- [about_Comparison_Operators](about_Comparison_Operators.md) -- [about_While](about_While.md) +- [about_Booleans][02] +- [about_Break][03] +- [about_Continue][05] +- [about_Operators][06] +- [about_Assignment_Operators][01] +- [about_Comparison_Operators][04] +- [about_While][07] + + +[01]: about_Assignment_Operators.md +[02]: about_Booleans.md +[03]: about_Break.md +[04]: about_Comparison_Operators.md +[05]: about_Continue.md +[06]: about_Operators.md +[07]: about_While.md + + + diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md index 0125855cb67a..dffaed5c99a5 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md @@ -1,7 +1,7 @@ --- description: Describes a language command you can use to traverse all the items in a collection of items. Locale: en-US -ms.date: 10/20/2023 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_foreach?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Foreach diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index ca996409bbef..0b81c43bc6cf 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -1,7 +1,7 @@ --- description: The `Format.ps1xml` files in PowerShell define the default display of objects in the PowerShell console. You can create your own `Format.ps1xml` files to change the display of objects or to define default displays for new object types that you create in PowerShell. Locale: en-US -ms.date: 12/26/2025 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Format.ps1xml @@ -358,7 +358,7 @@ the object property to be displayed in the defined location, or a to be displayed in the location. > [!NOTE] -> Script blocks can also be used elsewhere in locations where calculated +> Scriptblocks can also be used elsewhere in locations where calculated > results can be useful. The `` tag can also contain a `` tag that @@ -392,7 +392,7 @@ display the property. ### CustomControl tag -The `` tag lets you use a script block to define a format. A +The `` tag lets you use a scriptblock to define a format. A `` tag typically contains a `` tag that contains multiple `` tags. Each `` tag contains a `` tag that can contain a variety of tags that specify contents and diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md index 40f142fbb17e..94bf3b807c7e 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md @@ -1,7 +1,7 @@ --- description: Function Locale: en-US -ms.date: 03/06/2025 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_function_provider?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Function_Provider @@ -146,7 +146,7 @@ PS Function:\> Get-Item -Path .\c: ## Creating a function This command uses the `New-Item` cmdlet to create a function called `Win32:`. -The expression in braces is the script block that is represented by the +The expression in braces is the scriptblock that is represented by the function name. ```powershell @@ -212,7 +212,7 @@ Rename-Item -Path Function:help -NewName gh ## Copying a function This command copies the `prompt` function to `oldPrompt`, effectively creating -a new name for the script block that is associated with the prompt function. +a new name for the scriptblock that is associated with the prompt function. You can use this to save the original prompt function if you plan to change it. The **Options** property of the new function has a value of `None`. To change the value of the **Options** property, use `Set-Item`. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md index 87bb2a1971ba..c0334ae13d05 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md @@ -1,12 +1,11 @@ --- description: Describes how to create and use functions in PowerShell. Locale: en-US -ms.date: 07/16/2025 +ms.date: 01/18/2026 online version: https://learn.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 --- - # about_Functions ## Short description @@ -26,9 +25,9 @@ PowerShell defines two kinds of functions: pipeline. Filters are defined using the `filter` keyword. You can group the statements in a function into one of four different -predefined script blocks. These script blocks are named using the keywords -`begin`, `process`, and `end`. If you don't use these keywords, PowerShell puts -the statements in the appropriate code block. +predefined statement blocks. These statement blocks are named using the +keywords `begin`, `process`, `end`, and `clean`. If you don't use these +keywords, PowerShell puts the statements in the appropriate code block. Functions can also act like cmdlets. You can create a function that works just like a cmdlet without using `C#` programming. For more information, see @@ -104,7 +103,7 @@ The syntax of a filter is as follows: filter [] {} ``` -To simplify the syntax for `filter` functions, omit the script block keyword +To simplify the syntax for `filter` functions, omit the statement block keyword (`begin`, `process`, `end`). PowerShell puts the statements in the `process` block. You can use any of the other blocks in a filter function, but the intent was to provide a shorthand way of defining a function that has the sole purpose @@ -166,7 +165,7 @@ the function receives. The automatic variable `$_` or `$PSItem` contains the current object in the pipeline for use in the `process` block. The `$input` automatic variable -contains an enumerator that's only available to functions and script blocks. +contains an enumerator that's only available to functions and scriptblocks. For more information, see [about_Automatic_Variables][04]. - If the function is invoked without pipeline input, PowerShell executes the @@ -540,12 +539,12 @@ Sum = 10 When you use a function in a pipeline, the objects piped to the function are assigned to the `$input` automatic variable. The function runs statements with -the `begin` script block before any objects come from the pipeline. The -function runs statements with the `end` script block when there are no more +the `begin` statement block before any objects come from the pipeline. The +function runs statements with the `end` statement block when there are no more objects in the pipeline. The following example shows the `$input` automatic variable used int the -`begin` and `end` script blocks. +`begin` and `end` statement blocks. ```powershell function Get-PipelineBeginEnd { @@ -640,7 +639,7 @@ PowerShell: Get-ChildItem Function: ``` -The commands in the function are stored as a script block in the definition +The commands in the function are stored as a scriptblock in the definition property of the function. For example, to display the commands in the Help function that comes with PowerShell, type: diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md index ef9b150adb71..d8b6427b2bc9 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md @@ -1,7 +1,7 @@ --- description: Describes how functions that specify the `CmdletBinding` attribute can use the methods and properties that are available to compiled cmdlets. Locale: en-US -ms.date: 10/16/2024 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_advanced_methods?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Functions_Advanced_Methods @@ -80,7 +80,7 @@ the function receives. The automatic variable `$_` or `$PSItem` contains the current object in the pipeline for use in the `process` block. The `$input` automatic variable -contains an enumerator that's only available to functions and script blocks. +contains an enumerator that's only available to functions and scriptblocks. For more information, see [about_Automatic_Variables][15]. - Calling the function at the beginning, or outside of a pipeline, executes the diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md index 48a924b36c38..8decd5f41242 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md @@ -1,12 +1,11 @@ --- description: Explains how to add parameters to advanced functions. Locale: en-US -ms.date: 02/25/2025 +ms.date: 01/18/2026 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 --- - # about_Functions_Advanced_Parameters ## Short description @@ -31,7 +30,7 @@ functions. For more information, see [about_Functions][14] and ## Parameter declaration Parameters are variables declared in the `param()` statement of a function or -script block. You can use the optional `[Parameter()]` attribute alone or in +scriptblock. You can use the optional `[Parameter()]` attribute alone or in combination with the `[Alias()]` attribute or any of the parameter validation attributes. @@ -561,14 +560,14 @@ Saw that ComputerName was 'HelloWorld' > [!NOTE] > A typed parameter that accepts pipeline input (`by Value`) or -> (`by PropertyName`) enables use of _delay-bind_ script blocks on the +> (`by PropertyName`) enables use of _delay-bind_ scriptblocks on the > parameter. > -> The _delay-bind_ script block is run automatically during +> The _delay-bind_ scriptblock is run automatically during > **ParameterBinding**. The result is bound to the parameter. Delay binding > doesn't work for parameters defined as type **ScriptBlock** or -> **System.Object**. The script block is passed through _without_ being -> invoked. For more information about _delay-bind_ script blocks, see +> **System.Object**. The scriptblock is passed through _without_ being +> invoked. For more information about _delay-bind_ scriptblocks, see > [about_Script_Blocks][16]. #### ValueFromRemainingArguments argument diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md index 9d4a6bfd26be..d5155ac72d60 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md @@ -1,7 +1,7 @@ --- description: Explains the various argument completion options available for function parameters. Locale: en-US -ms.date: 01/04/2022 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_Functions_Argument_Completion?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Functions_Argument_Completion @@ -117,8 +117,8 @@ 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. -To add an **ArgumentCompleter** attribute, you need to define a script block -that determines the values. The script block must take the following +To add an **ArgumentCompleter** attribute, you need to define a scriptblock +that determines the values. The scriptblock must take the following parameters in the order specified below. The parameter's names don't matter as the values are provided positionally. @@ -141,16 +141,16 @@ function MyArgumentCompleter { } ``` -### ArgumentCompleter script block +### ArgumentCompleter scriptblock -The script block parameters are set to the following values: +The scriptblock parameters are set to the following values: - `$commandName` (Position 0) - This parameter is set to the name of the - command for which the script block is providing tab completion. + command for which the scriptblock is providing tab completion. - `$parameterName` (Position 1) - This parameter is set to the parameter whose value requires tab completion. - `$wordToComplete` (Position 2) - This parameter is set to value the user has - provided before they pressed Tab. Your script block should use + provided before they pressed Tab. Your scriptblock should use this value to determine tab completion values. - `$commandAst` (Position 3) - This parameter is set to the Abstract Syntax Tree (AST) for the current input line. For more information, see the @@ -161,7 +161,7 @@ The script block parameters are set to the following values: Tab. For more information, see [about_Automatic_Variables](about_Automatic_Variables.md). -The **ArgumentCompleter** script block must unroll the values using the +The **ArgumentCompleter** scriptblock must unroll the values using the pipeline, such as `ForEach-Object`, `Where-Object`, or another suitable method. Returning an array of values causes PowerShell to treat the entire array as **one** tab completion value. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md index e13cc1fe1f8d..d2410476855c 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md @@ -1,7 +1,7 @@ --- description: Describes the Group Policy settings for PowerShell Locale: en-US -ms.date: 08/17/2023 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_group_policy_settings?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Group_Policy_Settings @@ -85,17 +85,17 @@ previous commands to the 'All Users' PowerShell profile For more information about module logging, see [about_Modules](about_Modules.md). -## Turn on PowerShell script block logging +## Turn on PowerShell scriptblock logging The **Turn on PowerShell Script Block Logging** policy setting enables logging of all PowerShell script input to the Microsoft-Windows-PowerShell/Operational event log. If you enable this policy setting, PowerShell logs the processing of -commands, script blocks, functions, and scripts - whether invoked +commands, scriptblocks, functions, and scripts - whether invoked interactively, or through automation. If you disable this policy setting, PowerShell script input isn't logged. If you enable the Script Block Invocation Logging, PowerShell also logs events -when invocation of a command, script block, function, or script starts or +when invocation of a command, scriptblock, function, or script starts or stops. Enabling Invocation Logging generates a high volume of event logs. ## Turn on script execution diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md index 195a78423759..010439207fa2 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md @@ -1,7 +1,7 @@ --- description: Explains language modes and their effect on PowerShell sessions. Locale: en-US -ms.date: 04/03/2025 +ms.date: 01/18/2026 no-loc: [FullLanguage, ConstrainedLanguage, RestrictedLanguage, NoLanguage] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_modes?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -161,7 +161,7 @@ versions of Windows. ### `RestrictedLanguage` mode In `RestrictedLanguage` mode, users can run commands (cmdlets, functions, CIM -commands, and workflows), but can't use script blocks. This mode is also used +commands, and workflows), but can't use scriptblocks. This mode is also used to process modules manifests loaded by `Import-Module`. Beginning in PowerShell 7.2, the `New-Object` cmdlet is disabled in diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md index 863bc29352b7..a0b2072b4c95 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md @@ -1,7 +1,7 @@ --- description: Explains how to create objects in PowerShell. Locale: en-US -ms.date: 12/05/2022 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_object_creation?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Object_Creation @@ -33,7 +33,7 @@ There are many ways to create objects, this list is not definitive: - [Add-Type][10]: Allows you to define a class in your PowerShell session that you can instantiate with `New-Object`. - [New-Module][08]: The **AsCustomObject** parameter creates a custom object - you define using script block. + you define using scriptblock. - [Add-Member][09]: Adds properties to existing objects. You can use `Add-Member` to create a custom object out of a simple type, like `[System.Int32]`. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md index a66fc03e1d68..fb4714ef4d06 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md @@ -1,23 +1,23 @@ --- description: Describes the operators that are supported by PowerShell. Locale: en-US -ms.date: 04/30/2025 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Operators --- # about_Operators -## SHORT DESCRIPTION +## Short description Describes the operators that are supported by PowerShell. -## LONG DESCRIPTION +## Long description An operator is a language element that you can use in a command or expression. PowerShell supports several types of operators to help you manipulate values. -## ARITHMETIC OPERATORS +## Arithmetic operators Use arithmetic operators (`+`, `-`, `*`, `/`, `%`) to calculate values in a command or expression. With these operators, you can add, subtract, multiply, @@ -34,7 +34,7 @@ manipulate the bit patterns in values. For more information, see [about_Arithmetic_Operators][05]. -## ASSIGNMENT OPERATORS +## Assignment operators Use assignment operators (`=`, `+=`, `-=`, `*=`, `/=`, `%=`) to assign, change, or append values to variables. You can combine arithmetic operators with @@ -42,7 +42,7 @@ assignment to assign the result of the arithmetic operation to a variable. For more information, see [about_Assignment_Operators][06]. -## COMPARISON OPERATORS +## Comparison operators Use comparison operators (`-eq`, `-ne`, `-gt`, `-lt`, `-le`, `-ge`) to compare values and test conditions. For example, you can compare two string values to @@ -60,7 +60,7 @@ given type. For more information, see [about_Comparison_Operators][07]. -## LOGICAL OPERATORS +## Logical operators Use logical operators (`-and`, `-or`, `-xor`, `-not`, `!`) to connect conditional statements into a single complex conditional. For example, you can @@ -69,7 +69,7 @@ conditions. For more information, see [about_Logical_Operators][13]. -## REDIRECTION OPERATORS +## Redirection operators Use redirection operators (`>`, `>>`, `2>`, `2>>`, and `2>&1`) to send the output of a command or expression to a text file. The redirection operators @@ -79,7 +79,7 @@ cmdlet to redirect output. For more information, see [about_Redirection][18] -## SPLIT AND JOIN OPERATORS +## Split and join operators The `-split` and `-join` operators divide and combine substrings. The `-split` operator splits a string into substrings. The `-join` operator concatenates @@ -87,14 +87,14 @@ multiple strings into a single string. For more information, see [about_Split][21] and [about_Join][12]. -## TYPE OPERATORS +## Type operators Use the type operators (`-is`, `-isnot`, `-as`) to find or change the .NET type of an object. For more information, see [about_Type_Operators][22]. -## UNARY OPERATORS +## Unary operators Use the unary `++` and `--` operators to increment or decrement values and `-` for negation. For example, to increment the variable `$a` from `9` to @@ -102,7 +102,7 @@ Use the unary `++` and `--` operators to increment or decrement values and For more information, see [about_Arithmetic_Operators][05]. -## SPECIAL OPERATORS +## Special operators Special operators have specific use-cases that don't fit into any other operator group. For example, special operators allow you to run commands, @@ -262,9 +262,9 @@ table. For more information, see [about_Hash_Tables][09]. ### Call operator `&` -Runs a command, script, or script block. The call operator, also known as the +Runs a command, script, or scriptblock. The call operator, also known as the _invocation operator_, lets you run commands that are stored in variables and -represented by strings or script blocks. The call operator executes in a child +represented by strings or scriptblocks. The call operator executes in a child scope. For more about scopes, see [about_Scopes][19]. You can use this to build strings containing the command, parameters, and arguments you need, and then invoke the string as if it were a command. The strings that you create must @@ -341,7 +341,7 @@ PS C:\Scripts> & ".\script name with spaces.ps1" Hello World! ``` -For more about script blocks, see [about_Script_Blocks][20]. +For more about scriptblocks, see [about_Script_Blocks][20]. ### Cast operator `[ ]` @@ -598,7 +598,7 @@ properties and methods of an object, use the Static parameter of the 'MinValue', 'MaxValue' | ForEach-Object { [int]:: $_ } ``` -## SEE ALSO +## See also - [about_Arithmetic_Operators][05] - [about_Assignment_Operators][06] diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md index f0b391974f92..ae50c627e3b8 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md @@ -1,7 +1,7 @@ --- description: Describes how to work with command parameters in PowerShell. Locale: en-US -ms.date: 09/28/2021 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parameters?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Parameters @@ -211,16 +211,16 @@ has a property called **Name**. > [!NOTE] > A typed parameter that accepts pipeline input (`by Value`) or -> (`by PropertyName`) enables use of **delay-bind** script blocks on the +> (`by PropertyName`) enables use of **delay-bind** scriptblocks on the > parameter. > -> The **delay-bind** script block is run automatically during +> The **delay-bind** scriptblock is run automatically during > **ParameterBinding**. The result is bound to the parameter. Delay binding > does **not** work for parameters defined as type `ScriptBlock` or -> `System.Object`, the script block is passed through +> `System.Object`, the scriptblock is passed through > **without** being invoked. > -> You can read about **delay-bind** script blocks here +> You can read about **delay-bind** scriptblocks here > [about_Script_Blocks.md](about_Script_Blocks.md) #### Accepts Wildcard Characters diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index 01d5c6f8eb79..b231fe3690e4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -1,7 +1,7 @@ --- description: Describes how to set custom default values for cmdlet parameters and advanced functions. Locale: en-US -ms.date: 01/02/2025 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parameters_default_values?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Parameters_Default_Values @@ -55,8 +55,8 @@ name must match the name as reported by > aliases. The _value_ can be an object of a type that's compatible with the parameter or -a **ScriptBlock** that returns such a value. When the value is a script block, -PowerShell evaluates the script block and uses the result for the parameter +a **ScriptBlock** that returns such a value. When the value is a scriptblock, +PowerShell evaluates the scriptblock and uses the result for the parameter value. If the specified parameter expects a **ScriptBlock** type, you must enclose the value in another set of braces. When PowerShell evaluates the outer **ScriptBlock**, the result is the inner **ScriptBlock**. The inner @@ -156,10 +156,10 @@ PS> $PSDefaultParameterValues.'Get-*:Verbose' # member access notation True ``` -### Use a script block for the default value +### Use a scriptblock for the default value -You can use a script block to specify different default values for a parameter -under different conditions. PowerShell evaluates the script block and uses the +You can use a scriptblock to specify different default values for a parameter +under different conditions. PowerShell evaluates the scriptblock and uses the result as the default parameter value. The `Format-Table:AutoSize` key sets that switch parameter to a default value diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md index 4c21080c40db..dc610c4e9e37 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md @@ -1,7 +1,7 @@ --- description: Describes how PowerShell parses commands. Locale: en-US -ms.date: 05/06/2024 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Parsing @@ -108,7 +108,7 @@ uses one of the following syntaxes: - Quotation marks (`'` and `"`) begin strings -- Braces (`{}`) begin a new script blocks +- Braces (`{}`) begin a new scriptblock - Commas (`,`) introduce lists passed as arrays, unless the command being called is a native application, in which case they're interpreted as part of diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Ref.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Ref.md index a9012081ce76..2eb955ec1eb9 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Ref.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Ref.md @@ -1,7 +1,7 @@ --- description: Describes how to create and use a reference type variable. You can use reference type variables to permit a function to change the value of a variable that is passed to it. Locale: en-US -ms.date: 12/12/2024 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_ref?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Ref @@ -166,13 +166,13 @@ not possible, such as in script-block parameter values. For example, you can use script-block parameter values to calculate the value of **NewName** parameter of the `Rename-Item` cmdlet. The `Rename-Item` cmdlet -allows you to pipe items to it. The command run the script block passed to the -**NewName** for each item in the pipeline. The script block run in a child +allows you to pipe items to it. The command run the scriptblock passed to the +**NewName** for each item in the pipeline. The scriptblock run in a child scope. Modifying a variable in the caller's scope directly won't help and you -can't pass arguments to the script block in this context. +can't pass arguments to the scriptblock in this context. -In this example, the script block passed to the **NewName** parameter -increments the value of `$iRef` for each item in the pipeline. The script block +In this example, the scriptblock passed to the **NewName** parameter +increments the value of `$iRef` for each item in the pipeline. The scriptblock creates a new name by adding a number to the beginning of the filename. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Return.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Return.md index bed4829d4d66..b4a9cc235bd4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Return.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Return.md @@ -1,7 +1,7 @@ --- description: Exits the current scope, which can be a function, script, or script block. Locale: en-US -ms.date: 01/03/2018 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_return?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Return @@ -10,11 +10,11 @@ title: about_Return ## Short description -Exits the current scope, which can be a function, script, or script block. +Exits the current scope, which can be a function, script, or scriptblock. ## Long description -The `return` keyword exits a function, script, or script block. It can be used +The `return` keyword exits a function, script, or scriptblock. It can be used to exit a scope at a specific point, to return a value, or to indicate that the end of the scope has been reached. @@ -149,7 +149,7 @@ PS> $a ### Return values and the Pipeline -When you return a collection from your script block or function, PowerShell +When you return a collection from your scriptblock or function, PowerShell automatically unrolls the members and passes them one at a time through the pipeline. This is due to PowerShell's one-at-a-time processing. For more information, see [about_Pipelines](about_pipelines.md). @@ -176,7 +176,7 @@ Minimum : Property : ``` -To force a script block or function to return collection as a single +To force a scriptblock or function to return collection as a single object to the pipeline, use one of the following two methods: - Unary array expression diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Script_Blocks.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Script_Blocks.md index 9ef857f4532f..7ad9c6354fb0 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Script_Blocks.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Script_Blocks.md @@ -1,7 +1,7 @@ --- description: Defines what a script block is and explains how to use script blocks in the PowerShell programming language. Locale: en-US -ms.date: 11/28/2023 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Script_Blocks @@ -10,33 +10,33 @@ title: about_Script_Blocks ## Short description -Defines what a script block is and explains how to use script blocks in +Defines what a scriptblock is and explains how to use scriptblocks in the PowerShell programming language. ## Long description -In the PowerShell programming language, a script block is a collection of +In the PowerShell programming language, a scriptblock is a collection of statements or expressions that can be used as a single unit. The collection of statements can be enclosed in braces (`{}`), defined as a function, or saved in -a script file. A script block can return values and accept parameters and -arguments. +a script file. A scriptblock can return values and accept parameters and +arguments. Scriptblocks create a new scope for variables. -Syntactically, a script block is a statement list in braces, as shown in +Syntactically, a scriptblock is a statement list in braces, as shown in the following syntax: ``` {} ``` -A script block returns the output of all the commands in the script block, +A scriptblock returns the output of all the commands in the scriptblock, either as a single object or as an array. You can also specify a return value using the `return` keyword. The `return` -keyword doesn't affect or suppress other output returned from your script -block. However, the `return` keyword exits the script block at that line. For -more information, see [about_Return][04]. +keyword doesn't affect or suppress other output returned from your scriptblock. +However, the `return` keyword exits the scriptblock at that line. For more +information, see [about_Return][04]. -Like functions, a script block can include parameters. Use the `param` +Like functions, a scriptblock can include parameters. Use the `param` keyword to assign named parameters, as shown in the following syntax: ``` @@ -46,21 +46,22 @@ keyword to assign named parameters, as shown in the following syntax: } ``` -> [!NOTE] -> In a script block, unlike a function, you can't specify parameters outside -> the braces. +Like functions, scriptblocks can include the `dynamicparam` statement, and the +`begin`, `process`, and `end` statements. For more information, see +[about_Functions][02] and [about_Functions_Advanced][01]. -Like functions, script blocks can include the `dynamicparam`, `begin`, -`process`, and `end` keywords. For more information, see [about_Functions][02] -and [about_Functions_Advanced][01]. +> [!IMPORTANT] +> Not all blocks enclosed in braces are scriptblocks. For example, the commands +> in a `for` loop or an `if` statement are enclosed in a statement block. +> Statement blocks do not create a new scope for variables, support parameters +> of the other statement keywords. -## Using script blocks +## Using scriptblocks -A script block is an instance of a Microsoft .NET Framework type -`System.Management.Automation.ScriptBlock`. Commands can have script -block parameter values. For example, the `Invoke-Command` cmdlet has a -`ScriptBlock` parameter that takes a script block value, as shown in this -example: +A scriptblock is an instance of a Microsoft .NET Framework type +`System.Management.Automation.ScriptBlock`. Commands can have scriptblock +parameter values. For example, the `Invoke-Command` cmdlet has a `ScriptBlock` +parameter that takes a scriptblock value, as shown in this example: ```powershell Invoke-Command -ScriptBlock { Get-Process } @@ -74,7 +75,7 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ... ``` -`Invoke-Command` can also execute script blocks that have parameter blocks. +`Invoke-Command` can also execute scriptblocks that have parameter blocks. Parameters are assigned by position using the **ArgumentList** parameter. ```powershell @@ -89,15 +90,15 @@ p1: First p2: Second ``` -The script block in the preceding example uses the `param` keyword to +The scriptblock in the preceding example uses the `param` keyword to create a parameters `$p1` and `$p2`. The string "First" is bound to the first parameter (`$p1`) and "Second" is bound to (`$p2`). For more information about the behavior of **ArgumentList**, see [about_Splatting][05]. -You can use variables to store and execute script blocks. The example below -stores a script block in a variable and passes it to `Invoke-Command`. +You can use variables to store and execute scriptblocks. The example below +stores a scriptblock in a variable and passes it to `Invoke-Command`. ```powershell $a = { Get-Service BITS } @@ -110,10 +111,10 @@ Status Name DisplayName Running BITS Background Intelligent Transfer Ser... ``` -The call operator is another way to execute script blocks stored in a variable. -Like `Invoke-Command`, the call operator executes the script block in a child +The call operator is another way to execute scriptblocks stored in a variable. +Like `Invoke-Command`, the call operator executes the scriptblock in a child scope. The call operator can make it easier for you to use parameters with your -script blocks. +scriptblocks. ```powershell $a ={ param($p1, $p2) @@ -128,7 +129,7 @@ p1: Second p2: First ``` -You can store the output from your script blocks in a variable using +You can store the output from your scriptblocks in a variable using assignment. ``` @@ -147,13 +148,13 @@ PS> $b For more information about the call operator, see [about_Operators][03]. -## Using delay-bind script blocks with parameters +## Using delay-bind scriptblocks with parameters A typed parameter that accepts pipeline input enables use of _delay-bind_ -script blocks on the parameter. You can use delay-bind script blocks as a +scriptblocks on the parameter. You can use delay-bind scriptblocks as a shorthand to define parameters for a pipelined cmdlet before executing it. -Within the delay-bind script block, you can reference the piped in object +Within the delay-bind scriptblock, you can reference the piped in object using the pipeline variable `$_`. ```powershell @@ -166,16 +167,16 @@ dir config.log | ForEach-Object -Process { dir config.log | Rename-Item -NewName { "old_$($_.Name)" } ``` -In more complex cmdlets, delay-bind script blocks allow the reuse of one piped +In more complex cmdlets, delay-bind scriptblocks allow the reuse of one piped in object to populate other parameters. -Notes on delay-bind script blocks as parameters: +Notes on delay-bind scriptblocks as parameters: - You must explicitly specify any parameter names you use with delay-bind - script blocks. + scriptblocks. - The parameter must not be untyped, and the parameter's type can't be `[scriptblock]` or `[Object]`. -- You receive an error if you use a delay-bind script block without providing +- You receive an error if you use a delay-bind scriptblock without providing pipeline input. ```powershell @@ -184,7 +185,7 @@ Notes on delay-bind script blocks as parameters: ```Output Rename-Item : Cannot evaluate parameter 'NewName' because its argument is - specified as a script block and there is no input. A script block cannot + specified as a scriptblock and there is no input. A scriptblock cannot be evaluated without input. At line:1 char:23 + Rename-Item -NewName {$_.Name + ".old"} diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md index 3775d923c693..438f9977f301 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md @@ -1,7 +1,7 @@ --- description: Describes session configuration files, which are used in a session configuration (also known as an endpoint) to define the environment of sessions that use the session configuration. Locale: en-US -ms.date: 01/03/2018 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_session_configuration_files?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Session_Configuration_Files @@ -53,7 +53,7 @@ the modules required for those tasks; and sessions where unprivileged users can only run specific commands as a privileged account. In addition to that, you can manage whether users of the session can use -PowerShell language elements such as script blocks, or whether they can only +PowerShell language elements such as scriptblocks, or whether they can only run commands. You can manage the version of PowerShell users can run in the session; manage which modules are imported into the session; and manage which cmdlets, functions, and aliases session users can run. When using the diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Simplified_Syntax.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Simplified_Syntax.md index c985b1620c5d..79f1f2833913 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Simplified_Syntax.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Simplified_Syntax.md @@ -1,7 +1,7 @@ --- description: Describes easier, more natural-language ways of scripting filters for collections of objects. Locale: en-US -ms.date: 04/26/2024 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_simplified_syntax?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Simplified_Syntax @@ -16,13 +16,13 @@ collections of objects. ## Long description Simplified syntax, introduced in Windows PowerShell 3.0, lets you build some -filter commands without using script blocks. The simplified syntax more closely +filter commands without using scriptblocks. The simplified syntax more closely resembles natural language, and is primarily useful with collections of objects that get piped into commands `Where-Object` and `ForEach-Object` or their corresponding aliases `where` and `foreach`. You can use a method on the members of a collection (most commonly, an array) -without referring to the automatic variable `$_` inside a script block. +without referring to the automatic variable `$_` inside a scriptblock. Consider the following two invocations: @@ -45,7 +45,7 @@ Get-ChildItem Cert:\ -Recurse | Under the simplified syntax, comparison operators that work on members of objects in a collection are implemented as parameters. Also, you can invoke a method on objects in a collection without referring to the automatic variable -`$_` inside a script block. Compare the following two invocations to the +`$_` inside a scriptblock. Compare the following two invocations to the standard syntax examples: ```powershell @@ -65,7 +65,7 @@ dir Cert:\ -Recurse | foreach GetKeyAlgorithm ``` While both syntaxes work, the simplified syntax returns results without -referring to the automatic variable `$_` inside a script block. The simplified +referring to the automatic variable `$_` inside a scriptblock. The simplified syntax reads more like a natural language statement and can be easier to understand. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md index 7a03490dd808..c119df374449 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -1,12 +1,11 @@ --- description: Describes how to use splatting to pass parameters to commands in PowerShell. Locale: en-US -ms.date: 01/29/2024 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Splatting --- - # about_Splatting ## Short description @@ -116,14 +115,14 @@ Copy-Item @ArrayArguments -WhatIf ### Using the ArgumentList parameter Several cmdlets have an **ArgumentList** parameter that is used to pass -parameter values to a script block that is executed by the cmdlet. The +parameter values to a scriptblock that is executed by the cmdlet. The **ArgumentList** parameter takes an array of values that is passed to the -script block. PowerShell is effectively using array splatting to bind the -values to the parameters of the script block. When using **ArgumentList**, if +scriptblock. PowerShell is effectively using array splatting to bind the +values to the parameters of the scriptblock. When using **ArgumentList**, if you need to pass an array as a single object bound to a single parameter, you must wrap the array as the only element of another array. -The following example has a script block that takes a single parameter that is +The following example has a scriptblock that takes a single parameter that is an array of strings. ```powershell @@ -133,7 +132,7 @@ Invoke-Command -ScriptBlock { } -ArgumentList $array ``` -In this example, only the first item in `$array` is passed to the script block. +In this example, only the first item in `$array` is passed to the scriptblock. ```Output Hello @@ -147,7 +146,7 @@ Invoke-Command -ScriptBlock { ``` In this example, `$array` is wrapped in an array so that the entire -array is passed to the script block as a single object. +array is passed to the scriptblock as a single object. ```Output Hello World! diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Split.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Split.md index f8e16b4de969..65123e7ac4f9 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Split.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Split.md @@ -1,7 +1,7 @@ --- description: Explains how to use the Split operator to split one or more strings into substrings. Locale: en-US -ms.date: 01/09/2025 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_split?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Split @@ -19,7 +19,7 @@ The Split operator splits one or more strings into substrings. You can change the following elements of the Split operation: - Delimiter. The default is whitespace, but you can specify characters, - strings, patterns, or script blocks that specify the delimiter. The Split + strings, patterns, or scriptblocks that specify the delimiter. The Split operator in PowerShell uses a regular expression in the delimiter, rather than a simple character. - Maximum number of substrings. The default is to return all substrings. If @@ -43,7 +43,7 @@ values. The values must appear in the order specified in the syntax diagram. ``` You can substitute `-isplit` or `-csplit` for `-split` in any binary Split -statement (a Split statement that includes a delimiter or script block). The +statement (a Split statement that includes a delimiter or scriptblock). The `-isplit` and `-split` operators are case-insensitive. The `-csplit` operator is case-sensitive, meaning that case is considered when the delimiter rules are applied. @@ -184,7 +184,7 @@ Neptune ### \ An expression that specifies rules for applying the delimiter. The expression -must evaluate to $true or $false. Enclose the script block in braces. +must evaluate to $true or $false. Enclose the scriptblock in braces. Example: diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md index e75344bffb0f..56a2e16b7c66 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Switch.md @@ -1,10 +1,5 @@ --- -description: Explains how to use a switch to handle multiple `if` statements. -Locale: en-US -ms.date: 05/19/2025 -online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_switch?view=powershell-5.1&WT.mc_id=ps-gethelp -schema: 2.0.0 -title: about_Switch +ms.date: 01/18/2026 --- # about_Switch @@ -32,8 +27,8 @@ A basic `switch` statement has the following format: ```Syntax switch () { - {} - {} + {} + {} } ``` @@ -70,8 +65,8 @@ The complete `switch` statement syntax is as follows: ```Syntax switch [-Regex | -Wildcard | -Exact] [-CaseSensitive] () { string | number | variable | { } - { } - default { } # optional + { } + default { } # optional } ``` @@ -80,8 +75,8 @@ or ```Syntax switch [-Regex | -Wildcard | -Exact] [-CaseSensitive] -File filename { string | number | variable | { } - { } - default { } # optional + { } + default { } # optional } ``` @@ -196,7 +191,7 @@ switch (1,4,-1,3,"Hello",2,1) { ### Impact of string conversion All values, both input and the comparison value are converted to strings for -comparison. To avoid unintended string conversion, use script blocks to +comparison. To avoid unintended string conversion, use scriptblocks to evaluate the switch value. ```powershell @@ -264,8 +259,8 @@ Hashtable string coercion In this example, the `switch` statement is testing for the type of the value in the hashtable. We must enumerate the items in the hashtable before we can test -the values. To avoid the complications of string conversion, use a script block -that returns a boolean value to select the action scriptblock to execute. +the values. To avoid the complications of string conversion, use a scriptblock +that returns a boolean value to select the action statement to execute. ```powershell $var = @{A = 10; B = 'abc'} @@ -361,7 +356,7 @@ switch -Regex ($target) { https://bing.com is a web address that uses https ``` -The following example demonstrates the use of script blocks as `switch` +The following example demonstrates the use of scriptblocks as `switch` statement conditions. ```powershell @@ -378,7 +373,7 @@ This Test executes as well The following example processes an array containing two date values. The `` compares the **Year** property of each date. The -`` displays a welcome message or the number of days until +`` displays a welcome message or the number of days until the beginning of the year 2022. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Throw.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Throw.md index 4ed3c613a05d..d4d32399004e 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Throw.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Throw.md @@ -1,7 +1,7 @@ --- description: Describes the `throw` keyword, which generates a terminating error. Locale: en-US -ms.date: 08/24/2022 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_throw?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Throw @@ -17,9 +17,9 @@ Describes the `throw` keyword that generates a terminating error. The `throw` keyword causes a terminating error. You can use the `throw` keyword to stop the processing of a command, function, or script. -For example, you can use the `throw` keyword in the script block of an `if` +For example, you can use the `throw` keyword in the statement block of an `if` statement to respond to a condition or in the `catch` block of a -`try`-`catch`-`finally` statement. +`try/catch/finally` statement. The `throw` keyword can throw any object, such as a user message string or the object that caused the error. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md index 811286026ecd..72c1dd568972 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Types.ps1xml.md @@ -1,7 +1,7 @@ --- description: Explains how to use `Types.ps1xml` files to extend the types of objects that are used in PowerShell. Locale: en-US -ms.date: 08/07/2024 +ms.date: 01/18/2026 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_types.ps1xml?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Types.ps1xml @@ -154,7 +154,7 @@ property of arrays in PowerShell. For example: The `.ps1xml` files that are installed with PowerShell are digitally signed to prevent tampering because the formatting can include -script blocks. Therefore, to add a property or method to a .NET +scriptblocks. Therefore, to add a property or method to a .NET type, create your own `Types.ps1xml` files, and then add them to your PowerShell session. @@ -184,7 +184,7 @@ This example shows how to add an **Age** property to **System.IO.FileInfo** objects. The age of a file is the difference between its creation time and the current time in days. -Because the **Age** property is calculated by using a script block, find a +Because the **Age** property is calculated by using a scriptblock, find a `` tag to use as a model for the new **Age** property. Save the follow XML code to the file `$PSHOME\MyTypes.ps1xml`. @@ -455,9 +455,9 @@ For example, the following XML creates a **PropertySet** named Defines a method whose value is the output of a script. -The `` tag must have a `` tag that specifies the -name of the new method and a `