From 384c050ead1166a2a6f12a7be135eca75a5f8ead Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Tue, 14 Nov 2023 17:41:09 -0600 Subject: [PATCH 1/2] Update references to 7.4 for GA release --- .../5.1/PSReadLine/About/about_PSReadLine.md | 27 ++- .../About/about_PowerShell_Editions.md | 203 +++++++++-------- .../7.2/PSReadLine/About/about_PSReadLine.md | 6 +- .../About/about_PowerShell_Editions.md | 211 ++++++++++-------- .../About/about_Properties.md | 35 +-- .../7.3/PSReadLine/About/about_PSReadLine.md | 4 +- .../About/about_Pipelines.md | 4 +- .../About/about_PowerShell_Editions.md | 211 ++++++++++-------- .../About/about_Pwsh.md | 4 +- .../Microsoft.PowerShell.Core/Save-Help.md | 6 +- .../Microsoft.PowerShell.Core/Update-Help.md | 6 +- .../Invoke-RestMethod.md | 6 +- .../Invoke-WebRequest.md | 6 +- .../7.4/PSReadLine/About/about_PSReadLine.md | 6 +- .../create-feedback-provider.md | 40 ++-- .../install/PowerShell-Support-Lifecycle.md | 16 +- .../docs-conceptual/install/install-debian.md | 16 +- .../docs-conceptual/install/install-rhel.md | 10 +- .../docs-conceptual/install/install-ubuntu.md | 16 +- .../learn/application-control.md | 12 +- .../learn/experimental-features.md | 28 ++- .../whats-new/What-s-New-in-PowerShell-74.md | 16 +- reference/includes/alpine-support.md | 4 +- reference/includes/debian-support.md | 4 +- reference/includes/macos-support.md | 14 +- reference/includes/rhel-support.md | 12 +- reference/includes/ubuntu-support.md | 2 +- reference/includes/windows-support.md | 12 +- 28 files changed, 510 insertions(+), 427 deletions(-) diff --git a/reference/5.1/PSReadLine/About/about_PSReadLine.md b/reference/5.1/PSReadLine/About/about_PSReadLine.md index af46bab6fad8..2790e8de1a1f 100644 --- a/reference/5.1/PSReadLine/About/about_PSReadLine.md +++ b/reference/5.1/PSReadLine/About/about_PSReadLine.md @@ -1,7 +1,7 @@ --- description: PSReadLine provides an improved command-line editing experience in the PowerShell console. Locale: en-US -ms.date: 10/11/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PSReadLine @@ -47,8 +47,8 @@ Install-Module -Name PSReadLine -AllowClobber -Force ## Custom Key Bindings PSReadLine supports custom key bindings using the `Set-PSReadLineKeyHandler` -cmdlet. Most custom key bindings call one of the -[bindable functions](about_PSReadLine_Functions.md), for example +cmdlet. Most custom key bindings call one of the [bindable functions][02], for +example ```powershell Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward @@ -104,7 +104,7 @@ You can see many more examples in the file `SamplePSReadLineProfile.ps1`, which is installed in the **PSReadLine** module folder. Most key bindings use some helper functions for editing the command line. Those -APIs are documented in [about_PSReadLine_Functions](about_PSReadLine_Functions.md). +APIs are documented in [about_PSReadLine_Functions][02]. ## Notes @@ -164,7 +164,7 @@ Get-ResultFromTwo -Secret1 (Get-Secret -Name blah -AsPlainText) -Secret2 sdv87ys If there are other commands you don't want written to the history files, you can use the **AddToHistoryHandler** parameter of the `Set-PSReadLineOption` cmdlet. For an example of how to use **AddToHistoryHandler**, see Example 7 of -[Set-PSReadLineOption](/powershell/module/psreadline/set-psreadlineoption#example-7-use-historyhandler-to-filter-commands-added-to-history). +[Set-PSReadLineOption][01]. #### PSReadLine 2.3.4 improves the filtering of sensitive data @@ -208,14 +208,13 @@ There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. - Current release is PSReadLine 2.3.4 -- PowerShell 7.4-preview ships with PSReadLine 2.2.6 +- PowerShell 7.4 ships with PSReadLine 2.3.4 - PowerShell 7.3 ships with PSReadLine 2.2.6 - PowerShell 7.2 ships with PSReadLine 2.1.0 - PowerShell 7.0.11 shipped with PSReadLine 2.0.4 - PowerShell 5.1 ships with PSReadLine 2.0.0 -For a full list of changes, see the PSReadLine -[ChangeLog](https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/Changes.txt). +For a full list of changes, see the PSReadLine [ChangeLog][04]. - **PSReadLine 2.3.4** @@ -286,11 +285,17 @@ enhancements: ### Feedback & contributing to PSReadLine -[PSReadLine on GitHub](https://github.com/PowerShell/PSReadLine) +[PSReadLine on GitHub][03] Feel free to submit a pull request or submit feedback on the GitHub page. ## See Also -- PSReadLine is heavily influenced by the GNU - [readline](https://tiswww.case.edu/php/chet/readline/rltop.html) library. +- PSReadLine is heavily influenced by the GNU [readline][05] library. + + +[01]: /powershell/module/psreadline/set-psreadlineoption#example-7-use-historyhandler-to-filter-commands-added-to-history +[02]: about_PSReadLine_Functions.md +[03]: https://github.com/PowerShell/PSReadLine +[04]: https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/Changes.txt +[05]: https://tiswww.case.edu/php/chet/readline/rltop.html diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index b5561ab31b16..2c1374126485 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -1,7 +1,7 @@ --- description: Different editions of PowerShell run on different underlying runtimes. Locale: en-US -ms.date: 03/23/2022 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_powershell_editions?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PowerShell Editions @@ -13,26 +13,29 @@ Different editions of PowerShell run on different underlying runtimes. ## Long description -From PowerShell 5.1, there are multiple *editions* of PowerShell that each run on -a different .NET runtime. As of PowerShell 6.0 there are two editions of PowerShell: +From PowerShell 5.1, there are multiple _editions_ of PowerShell that each run +on a different .NET runtime. As of PowerShell 6.0 there are two editions of +PowerShell: - **Desktop**, which runs on .NET Framework. PowerShell 4 and below, as well as - PowerShell 5.1 are available for full-featured Windows editions like Windows Desktop, - Windows Server, Windows Server Core and most other Windows operating systems. This is the original - PowerShell edition and is included in the default installation of the operating system. + PowerShell 5.1 are available for full-featured Windows editions like Windows + Desktop, Windows Server, Windows Server Core and most other Windows operating + systems. This is the original PowerShell edition and is included in the + default installation of the operating system. - **Core**, which runs on .NET Core. PowerShell 6.0 and later is installed - side-by-side with earlier PowerShell releases on full-featured Windows editions, some - reduced-footprint Windows editions such as Windows Nano Server and Windows IoT, or on non-Windows - platforms such as Linux and macOS. + side-by-side with earlier PowerShell releases on full-featured Windows + editions, some reduced-footprint Windows editions such as Windows Nano Server + and Windows IoT, or on non-Windows platforms such as Linux and macOS. -Because the edition of PowerShell corresponds to its .NET runtime, it is the primary indicator -of .NET API and PowerShell module compatibility; some .NET APIs, types or methods are not available -in both .NET runtimes and this affects PowerShell scripts and modules that depend on them. +Because the edition of PowerShell corresponds to its .NET runtime, it is the +primary indicator of .NET API and PowerShell module compatibility; some .NET +APIs, types or methods are not available in both .NET runtimes and this affects +PowerShell scripts and modules that depend on them. ## The `$PSEdition` automatic variable -In PowerShell 5.1 and above, you can find out what edition you are running with the `$PSEdition` -automatic variable: +In PowerShell 5.1 and above, you can find out what edition you are running with +the `$PSEdition` automatic variable: ```powershell $PSEdition @@ -42,12 +45,13 @@ $PSEdition Core ``` -In PowerShell 4 and below, this variable does not exist. `$PSEdition` being null should be treated -as the same as having the value `Desktop`. +In PowerShell 4 and below, this variable does not exist. `$PSEdition` being +null should be treated as the same as having the value `Desktop`. ### Edition in `$PSVersionTable` -The `$PSVersionTable` automatic variable also has **PSEdition** property in PowerShell 5.1 and above: +The `$PSVersionTable` automatic variable also has **PSEdition** property in +PowerShell 5.1 and above: ```powershell $PSVersionTable @@ -67,15 +71,16 @@ SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` -The **PSEdition** field has the same value as the `$PSEdition` automatic variable. +The **PSEdition** field has the same value as the `$PSEdition` automatic +variable. ## The `CompatiblePSEditions` module manifest field -PowerShell modules can declare what editions of PowerShell they are compatible with using the -`CompatiblePSEditions` field of the module manifest. +PowerShell modules can declare what editions of PowerShell they are compatible +with using the `CompatiblePSEditions` field of the module manifest. -For example, a module manifest declaring compatibility with both `Desktop` and `Core` editions -of PowerShell: +For example, a module manifest declaring compatibility with both `Desktop` and +`Core` editions of PowerShell: ```powershell @{ @@ -95,14 +100,14 @@ An example of a module manifest with only `Desktop` compatibility: } ``` -Omitting the `CompatiblePSEditions` field from a module manifest will have the same effect as -setting it to `Desktop`, since modules created before this field was introduced were implicitly -written for this edition. +Omitting the `CompatiblePSEditions` field from a module manifest will have the +same effect as setting it to `Desktop`, since modules created before this field +was introduced were implicitly written for this edition. -For modules not shipped as part of Windows (i.e. modules you write or install from the gallery), -this field is informational only; PowerShell does not change behavior based on the -`CompatiblePSEditions` field, but does expose it on the `PSModuleInfo` object (returned by -`Get-Module`) for your own logic: +For modules not shipped as part of Windows (i.e. modules you write or install +from the gallery), this field is informational only; PowerShell does not change +behavior based on the `CompatiblePSEditions` field, but does expose it on the +`PSModuleInfo` object (returned by `Get-Module`) for your own logic: ```powershell New-ModuleManifest -Path .\TestModuleWithEdition.psd1 -CompatiblePSEditions Desktop,Core -PowerShellVersion '5.1' @@ -116,14 +121,15 @@ Core ``` > [!NOTE] -> The `CompatiblePSEditions` module field is only compatible with PowerShell 5.1 and above. -> Including this field will cause a module to be incompatible with PowerShell 4 and below. -> Since the field is purely informational, it can be safely omitted in later PowerShell versions. +> The `CompatiblePSEditions` module field is only compatible with PowerShell +> 5.1 and above. Including this field will cause a module to be incompatible +> with PowerShell 4 and below. Since the field is purely informational, it can +> be safely omitted in later PowerShell versions. -In PowerShell 6.1, `Get-Module -ListAvailable` has had its formatter updated to display the -edition-compatibility of each module: +In PowerShell 6.1, `Get-Module -ListAvailable` has had its formatter updated to +display the edition-compatibility of each module: -```PowerShell +```powerShell Get-Module -ListAvailable ``` @@ -131,49 +137,52 @@ Get-Module -ListAvailable Directory: C:\Users\me\Documents\PowerShell\Modules -ModuleType Version Name PSEdition ExportedCommands ----------- ------- ---- --------- ---------------- -Script 1.4.0 Az Core,Desk -Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, E... -Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCreden... +ModuleType Version Name PSEdition ExportedCommands +---------- ------- ---- --------- ---------------- +Script 1.4.0 Az Core,Desk +Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, E... +Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCreden... ... -Script 4.4.0 Pester Desk {Describe, Context, It, Should...} -Script 1.18.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-... -Script 1.0.0 WindowsCompatibility Core {Initialize-WinSession, Add-WinFunction, Invoke-WinComm... +Script 4.4.0 Pester Desk {Describe, Context, It, Should...} +Script 1.18.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-... +Script 1.0.0 WindowsCompatibility Core {Initialize-WinSession, Add-WinFunction, Invoke-WinComm... ``` ## Edition-compatibility for modules that ship as part of Windows -For modules that come as part of Windows (or are installed as part of a role or feature), -PowerShell 6.1 and above treat the `CompatiblePSEditions` field differently. Such modules are found -in the Windows PowerShell system modules directory -(`%windir%\System\WindowsPowerShell\v1.0\Modules`). +For modules that come as part of Windows (or are installed as part of a role or +feature), PowerShell 6.1 and above treat the `CompatiblePSEditions` field +differently. Such modules are found in the Windows PowerShell system modules +directory (`%windir%\System\WindowsPowerShell\v1.0\Modules`). -For modules loaded from or found in this directory, PowerShell 6.1 and above uses the -`CompatiblePSEditions` field to determine whether the module will be compatible with the current -session and behaves accordingly. +For modules loaded from or found in this directory, PowerShell 6.1 and above +uses the `CompatiblePSEditions` field to determine whether the module will be +compatible with the current session and behaves accordingly. -When `Import-Module` is used, a module without `Core` in `CompatiblePSEditions` will not be imported -and an error will be displayed: +When `Import-Module` is used, a module without `Core` in `CompatiblePSEditions` +will not be imported and an error will be displayed: ```powershell Import-Module BitsTransfer ``` ```Output -Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1' does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module -SkipEditionCheck' to ignore the compatibility of this module. +Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1' + does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module + -SkipEditionCheck' to ignore the compatibility of this module. At line:1 char:1 + Import-Module BitsTransfer + ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026r\BitsTransfer.psd1:String) [Import-Module], InvalidOperationException ++ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026r\BitsTransfer.psd1:String) + [Import-Module], InvalidOperationException + FullyQualifiedErrorId : Modules_PSEditionNotSupported,Microsoft.PowerShell.Commands.ImportModuleCommand ``` -When `Get-Module -ListAvailable` is used, modules without `Core` in `CompatiblePSEditions` will not -be displayed: +When `Get-Module -ListAvailable` is used, modules without `Core` in +`CompatiblePSEditions` will not be displayed: ```powershell Get-Module -ListAvailable BitsTransfer @@ -183,7 +192,8 @@ Get-Module -ListAvailable BitsTransfer # No output ``` -In both cases, the `-SkipEditionCheck` switch parameter can be used to override this behavior: +In both cases, the `-SkipEditionCheck` switch parameter can be used to override +this behavior: ```powershell Get-Module -ListAvailable -SkipEditionCheck BitsTransfer @@ -193,57 +203,68 @@ Get-Module -ListAvailable -SkipEditionCheck BitsTransfer Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules -ModuleType Version Name PSEdition ExportedCommands ----------- ------- ---- --------- ---------------- -Manifest 2.0.0.0 BitsTransfer Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer,... +ModuleType Version Name PSEdition ExportedCommands +---------- ------- ---- --------- ---------------- +Manifest 2.0.0.0 BitsTransfer Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer,... ``` > [!WARNING] -> `Import-Module -SkipEditionCheck` may appear to succeed for a module, but using that module -> runs the risk of encountering an incompatibility later on; while loading the module initially -> succeeds, a command may later call an incompatible API and fail spontaneously. +> `Import-Module -SkipEditionCheck` may appear to succeed for a module, but +> using that module runs the risk of encountering an incompatibility later on; +> while loading the module initially succeeds, a command may later call an +> incompatible API and fail spontaneously. ## Authoring PowerShell modules for edition cross-compatibility -When writing a PowerShell module to target both `Desktop` and `Core` editions of PowerShell, -there are things you can do to ensure cross-edition compatibility. +When writing a PowerShell module to target both `Desktop` and `Core` editions +of PowerShell, there are things you can do to ensure cross-edition +compatibility. -The only true way to confirm and continually validate compatibility however is to write tests for -your script or module and run them on all versions and editions of PowerShell you need compatibility -with. A recommended testing framework for this is [Pester][Pester]. +The only true way to confirm and continually validate compatibility however is +to write tests for your script or module and run them on all versions and +editions of PowerShell you need compatibility with. A recommended testing +framework for this is [Pester][07]. ### PowerShell script -As a language, PowerShell works the same between editions; it is the cmdlets, modules and .NET APIs -you use that are affected by edition compatibility. +As a language, PowerShell works the same between editions; it is the cmdlets, +modules and .NET APIs you use that are affected by edition compatibility. -Generally, scripts that work in PowerShell 6.1 and above will work with Windows PowerShell 5.1, -but there are some exceptions. +Generally, scripts that work in PowerShell 6.1 and above will work with Windows +PowerShell 5.1, but there are some exceptions. -[PSScriptAnalyzer][pssa] version 1.18+ has rules like [PSUseCompatibleCommands][psucc] and -[PSUseCompatibleTypes][psuct] that are able to detect possibly incompatible usage of commands and -.NET APIs in PowerShell scripts. +[PSScriptAnalyzer][08] version 1.18+ has rules like +[PSUseCompatibleCommands][03] and [PSUseCompatibleTypes][04] that are able to +detect possibly incompatible usage of commands and .NET APIs in PowerShell +scripts. ### .NET assemblies -If you are writing a binary module or a module that incorporates .NET assemblies (DLLs) generated -from source code, you should compile against [.NET Standard][netstd] and [PowerShell Standard][psstd] -for compile-time compatibility validation of .NET and PowerShell API compatibility. +If you are writing a binary module or a module that incorporates .NET +assemblies (DLLs) generated from source code, you should compile against +[.NET Standard][01] and [PowerShell Standard][06] for compile-time +compatibility validation of .NET and PowerShell API compatibility. -Although these libraries are able to check some compatibility at compile time, they won't be able -to catch possible behavioral differences between editions. For this you must still write tests. +Although these libraries are able to check some compatibility at compile time, +they won't be able to catch possible behavioral differences between editions. +For this you must still write tests. ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [Get-Module](xref:Microsoft.PowerShell.Core.Get-Module) -- [Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) -- [Modules with compatible PowerShell Editions](/powershell/gallery/concepts/module-psedition-support) - -[Pester]: https://github.com/pester/Pester/wiki/Pester -[pssa]: https://www.powershellgallery.com/packages/PSScriptAnalyzer/ -[psucc]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatiblecommands -[psuct]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatibletypes -[netstd]: /dotnet/standard/net-standard -[psstd]: https://devblogs.microsoft.com/powershell/powershell-standard-library-build-single-module-that-works-across-windows-powershell-and-powershell-core/ +- [about_Automatic_Variables][05] +- [Get-Module][09] +- [Import-Module][10] +- [Modules with compatible PowerShell Editions][02] + + +[01]: /dotnet/standard/net-standard +[02]: /powershell/gallery/concepts/module-psedition-support +[03]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatiblecommands +[04]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatibletypes +[05]: about_Automatic_Variables.md +[06]: https://devblogs.microsoft.com/powershell/powershell-standard-library-build-single-module-that-works-across-windows-powershell-and-powershell-core/ +[07]: https://github.com/pester/Pester/wiki/Pester +[08]: https://www.powershellgallery.com/packages/PSScriptAnalyzer/ +[09]: xref:Microsoft.PowerShell.Core.Get-Module +[10]: xref:Microsoft.PowerShell.Core.Import-Module diff --git a/reference/7.2/PSReadLine/About/about_PSReadLine.md b/reference/7.2/PSReadLine/About/about_PSReadLine.md index fab4714e7c70..2d3ab61d02fd 100644 --- a/reference/7.2/PSReadLine/About/about_PSReadLine.md +++ b/reference/7.2/PSReadLine/About/about_PSReadLine.md @@ -1,7 +1,7 @@ --- description: PSReadLine provides an improved command-line editing experience in the PowerShell console. Locale: en-US -ms.date: 10/11/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PSReadLine @@ -15,7 +15,7 @@ PowerShell console. ## Long Description -PowerShell 7.3 ships with PSReadLine 2.2.6. The current version is PSReadLine +PowerShell 7.2 ships with PSReadLine 2.1.0. The current version is PSReadLine 2.3.4. The current version of PSReadLine can be installed and used on Windows PowerShell 5.1 and newer. For some features, you need to be running PowerShell 7.2 or higher. @@ -251,7 +251,7 @@ There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. - Current release is PSReadLine 2.3.4 -- PowerShell 7.4-preview ships with PSReadLine 2.2.6 +- PowerShell 7.4 ships with PSReadLine 2.3.4 - PowerShell 7.3 ships with PSReadLine 2.2.6 - PowerShell 7.2 ships with PSReadLine 2.1.0 - PowerShell 7.0.11 shipped with PSReadLine 2.0.4 diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index 2433f6e157cd..b626786f6259 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -1,7 +1,7 @@ --- description: Different editions of PowerShell run on different underlying runtimes. Locale: en-US -ms.date: 03/23/2022 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_powershell_editions?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PowerShell Editions @@ -13,26 +13,29 @@ Different editions of PowerShell run on different underlying runtimes. ## Long description -From PowerShell 5.1, there are multiple *editions* of PowerShell that each run on -a different .NET runtime. As of PowerShell 6.0 there are two editions of PowerShell: +From PowerShell 5.1, there are multiple _editions_ of PowerShell that each run +on a different .NET runtime. As of PowerShell 6.0 there are two editions of +PowerShell: - **Desktop**, which runs on .NET Framework. PowerShell 4 and below, as well as - PowerShell 5.1 are available for full-featured Windows editions like Windows Desktop, - Windows Server, Windows Server Core and most other Windows operating systems. This is the original - PowerShell edition and is included in the default installation of the operating system. + PowerShell 5.1 are available for full-featured Windows editions like Windows + Desktop, Windows Server, Windows Server Core and most other Windows operating + systems. This is the original PowerShell edition and is included in the + default installation of the operating system. - **Core**, which runs on .NET Core. PowerShell 6.0 and later is installed - side-by-side with earlier PowerShell releases on full-featured Windows editions, some - reduced-footprint Windows editions such as Windows Nano Server and Windows IoT, or on non-Windows - platforms such as Linux and macOS. + side-by-side with earlier PowerShell releases on full-featured Windows + editions, some reduced-footprint Windows editions such as Windows Nano Server + and Windows IoT, or on non-Windows platforms such as Linux and macOS. -Because the edition of PowerShell corresponds to its .NET runtime, it is the primary indicator -of .NET API and PowerShell module compatibility; some .NET APIs, types or methods are not available -in both .NET runtimes and this affects PowerShell scripts and modules that depend on them. +Because the edition of PowerShell corresponds to its .NET runtime, it is the +primary indicator of .NET API and PowerShell module compatibility; some .NET +APIs, types or methods are not available in both .NET runtimes and this affects +PowerShell scripts and modules that depend on them. ## The `$PSEdition` automatic variable -In PowerShell 5.1 and above, you can find out what edition you are running with the `$PSEdition` -automatic variable: +In PowerShell 5.1 and above, you can find out what edition you are running with +the `$PSEdition` automatic variable: ```powershell $PSEdition @@ -42,12 +45,13 @@ $PSEdition Core ``` -In PowerShell 4 and below, this variable does not exist. `$PSEdition` being null should be treated -as the same as having the value `Desktop`. +In PowerShell 4 and below, this variable does not exist. `$PSEdition` being +null should be treated as the same as having the value `Desktop`. ### Edition in `$PSVersionTable` -The `$PSVersionTable` automatic variable also has **PSEdition** property in PowerShell 5.1 and above: +The `$PSVersionTable` automatic variable also has **PSEdition** property in +PowerShell 5.1 and above: ```powershell $PSVersionTable @@ -56,26 +60,27 @@ $PSVersionTable ```Output Name Value ---- ----- -PSVersion 7.3.0-preview.3 +PSVersion 7.3.9 PSEdition Core -GitCommitId 7.3.0-preview.3 -OS Microsoft Windows 10.0.22000 +GitCommitId 7.3.9 +OS Microsoft Windows 10.0.22621 Platform Win32NT -PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} +PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` -The **PSEdition** field has the same value as the `$PSEdition` automatic variable. +The **PSEdition** field has the same value as the `$PSEdition` automatic +variable. ## The `CompatiblePSEditions` module manifest field -PowerShell modules can declare what editions of PowerShell they are compatible with using the -`CompatiblePSEditions` field of the module manifest. +PowerShell modules can declare what editions of PowerShell they are compatible +with using the `CompatiblePSEditions` field of the module manifest. -For example, a module manifest declaring compatibility with both `Desktop` and `Core` editions -of PowerShell: +For example, a module manifest declaring compatibility with both `Desktop` and +`Core` editions of PowerShell: ```powershell @{ @@ -95,14 +100,14 @@ An example of a module manifest with only `Desktop` compatibility: } ``` -Omitting the `CompatiblePSEditions` field from a module manifest will have the same effect as -setting it to `Desktop`, since modules created before this field was introduced were implicitly -written for this edition. +Omitting the `CompatiblePSEditions` field from a module manifest will have the +same effect as setting it to `Desktop`, since modules created before this field +was introduced were implicitly written for this edition. -For modules not shipped as part of Windows (i.e. modules you write or install from the gallery), -this field is informational only; PowerShell does not change behavior based on the -`CompatiblePSEditions` field, but does expose it on the `PSModuleInfo` object (returned by -`Get-Module`) for your own logic: +For modules not shipped as part of Windows (i.e. modules you write or install +from the gallery), this field is informational only; PowerShell does not change +behavior based on the `CompatiblePSEditions` field, but does expose it on the +`PSModuleInfo` object (returned by `Get-Module`) for your own logic: ```powershell New-ModuleManifest -Path .\TestModuleWithEdition.psd1 -CompatiblePSEditions Desktop,Core -PowerShellVersion '5.1' @@ -116,14 +121,15 @@ Core ``` > [!NOTE] -> The `CompatiblePSEditions` module field is only compatible with PowerShell 5.1 and above. -> Including this field will cause a module to be incompatible with PowerShell 4 and below. -> Since the field is purely informational, it can be safely omitted in later PowerShell versions. +> The `CompatiblePSEditions` module field is only compatible with PowerShell +> 5.1 and above. Including this field will cause a module to be incompatible +> with PowerShell 4 and below. Since the field is purely informational, it can +> be safely omitted in later PowerShell versions. -In PowerShell 6.1, `Get-Module -ListAvailable` has had its formatter updated to display the -edition-compatibility of each module: +In PowerShell 6.1, `Get-Module -ListAvailable` has had its formatter updated to +display the edition-compatibility of each module: -```PowerShell +```powerShell Get-Module -ListAvailable ``` @@ -131,49 +137,52 @@ Get-Module -ListAvailable Directory: C:\Users\me\Documents\PowerShell\Modules -ModuleType Version Name PSEdition ExportedCommands ----------- ------- ---- --------- ---------------- -Script 1.4.0 Az Core,Desk -Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, E... -Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCreden... +ModuleType Version Name PSEdition ExportedCommands +---------- ------- ---- --------- ---------------- +Script 1.4.0 Az Core,Desk +Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, E... +Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCreden... ... -Script 4.4.0 Pester Desk {Describe, Context, It, Should...} -Script 1.18.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-... -Script 1.0.0 WindowsCompatibility Core {Initialize-WinSession, Add-WinFunction, Invoke-WinComm... +Script 4.4.0 Pester Desk {Describe, Context, It, Should...} +Script 1.18.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-... +Script 1.0.0 WindowsCompatibility Core {Initialize-WinSession, Add-WinFunction, Invoke-WinComm... ``` ## Edition-compatibility for modules that ship as part of Windows -For modules that come as part of Windows (or are installed as part of a role or feature), -PowerShell 6.1 and above treat the `CompatiblePSEditions` field differently. Such modules are found -in the Windows PowerShell system modules directory -(`%windir%\System\WindowsPowerShell\v1.0\Modules`). +For modules that come as part of Windows (or are installed as part of a role or +feature), PowerShell 6.1 and above treat the `CompatiblePSEditions` field +differently. Such modules are found in the Windows PowerShell system modules +directory (`%windir%\System\WindowsPowerShell\v1.0\Modules`). -For modules loaded from or found in this directory, PowerShell 6.1 and above uses the -`CompatiblePSEditions` field to determine whether the module will be compatible with the current -session and behaves accordingly. +For modules loaded from or found in this directory, PowerShell 6.1 and above +uses the `CompatiblePSEditions` field to determine whether the module will be +compatible with the current session and behaves accordingly. -When `Import-Module` is used, a module without `Core` in `CompatiblePSEditions` will not be imported -and an error will be displayed: +When `Import-Module` is used, a module without `Core` in `CompatiblePSEditions` +will not be imported and an error will be displayed: ```powershell Import-Module BitsTransfer ``` ```Output -Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1' does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module -SkipEditionCheck' to ignore the compatibility of this module. +Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1' + does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module + -SkipEditionCheck' to ignore the compatibility of this module. At line:1 char:1 + Import-Module BitsTransfer + ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026r\BitsTransfer.psd1:String) [Import-Module], InvalidOperationException ++ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026r\BitsTransfer.psd1:String) + [Import-Module], InvalidOperationException + FullyQualifiedErrorId : Modules_PSEditionNotSupported,Microsoft.PowerShell.Commands.ImportModuleCommand ``` -When `Get-Module -ListAvailable` is used, modules without `Core` in `CompatiblePSEditions` will not -be displayed: +When `Get-Module -ListAvailable` is used, modules without `Core` in +`CompatiblePSEditions` will not be displayed: ```powershell Get-Module -ListAvailable BitsTransfer @@ -183,7 +192,8 @@ Get-Module -ListAvailable BitsTransfer # No output ``` -In both cases, the `-SkipEditionCheck` switch parameter can be used to override this behavior: +In both cases, the `-SkipEditionCheck` switch parameter can be used to override +this behavior: ```powershell Get-Module -ListAvailable -SkipEditionCheck BitsTransfer @@ -193,57 +203,68 @@ Get-Module -ListAvailable -SkipEditionCheck BitsTransfer Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules -ModuleType Version Name PSEdition ExportedCommands ----------- ------- ---- --------- ---------------- -Manifest 2.0.0.0 BitsTransfer Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer,... +ModuleType Version Name PSEdition ExportedCommands +---------- ------- ---- --------- ---------------- +Manifest 2.0.0.0 BitsTransfer Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer,... ``` > [!WARNING] -> `Import-Module -SkipEditionCheck` may appear to succeed for a module, but using that module -> runs the risk of encountering an incompatibility later on; while loading the module initially -> succeeds, a command may later call an incompatible API and fail spontaneously. +> `Import-Module -SkipEditionCheck` may appear to succeed for a module, but +> using that module runs the risk of encountering an incompatibility later on; +> while loading the module initially succeeds, a command may later call an +> incompatible API and fail spontaneously. ## Authoring PowerShell modules for edition cross-compatibility -When writing a PowerShell module to target both `Desktop` and `Core` editions of PowerShell, -there are things you can do to ensure cross-edition compatibility. +When writing a PowerShell module to target both `Desktop` and `Core` editions +of PowerShell, there are things you can do to ensure cross-edition +compatibility. -The only true way to confirm and continually validate compatibility however is to write tests for -your script or module and run them on all versions and editions of PowerShell you need compatibility -with. A recommended testing framework for this is [Pester][Pester]. +The only true way to confirm and continually validate compatibility however is +to write tests for your script or module and run them on all versions and +editions of PowerShell you need compatibility with. A recommended testing +framework for this is [Pester][07]. ### PowerShell script -As a language, PowerShell works the same between editions; it is the cmdlets, modules and .NET APIs -you use that are affected by edition compatibility. +As a language, PowerShell works the same between editions; it is the cmdlets, +modules and .NET APIs you use that are affected by edition compatibility. -Generally, scripts that work in PowerShell 6.1 and above will work with Windows PowerShell 5.1, -but there are some exceptions. +Generally, scripts that work in PowerShell 6.1 and above will work with Windows +PowerShell 5.1, but there are some exceptions. -[PSScriptAnalyzer][pssa] version 1.18+ has rules like [PSUseCompatibleCommands][psucc] and -[PSUseCompatibleTypes][psuct] that are able to detect possibly incompatible usage of commands and -.NET APIs in PowerShell scripts. +[PSScriptAnalyzer][08] version 1.18+ has rules like +[PSUseCompatibleCommands][03] and [PSUseCompatibleTypes][04] that are able to +detect possibly incompatible usage of commands and .NET APIs in PowerShell +scripts. ### .NET assemblies -If you are writing a binary module or a module that incorporates .NET assemblies (DLLs) generated -from source code, you should compile against [.NET Standard][netstd] and [PowerShell Standard][psstd] -for compile-time compatibility validation of .NET and PowerShell API compatibility. +If you are writing a binary module or a module that incorporates .NET +assemblies (DLLs) generated from source code, you should compile against +[.NET Standard][01] and [PowerShell Standard][06] for compile-time +compatibility validation of .NET and PowerShell API compatibility. -Although these libraries are able to check some compatibility at compile time, they won't be able -to catch possible behavioral differences between editions. For this you must still write tests. +Although these libraries are able to check some compatibility at compile time, +they won't be able to catch possible behavioral differences between editions. +For this you must still write tests. ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [Get-Module](xref:Microsoft.PowerShell.Core.Get-Module) -- [Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) -- [Modules with compatible PowerShell Editions](/powershell/gallery/concepts/module-psedition-support) - -[Pester]: https://github.com/pester/Pester/wiki/Pester -[pssa]: https://www.powershellgallery.com/packages/PSScriptAnalyzer/ -[psucc]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatiblecommands -[psuct]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatibletypes -[netstd]: /dotnet/standard/net-standard -[psstd]: https://devblogs.microsoft.com/powershell/powershell-standard-library-build-single-module-that-works-across-windows-powershell-and-powershell-core/ +- [about_Automatic_Variables][05] +- [Get-Module][09] +- [Import-Module][10] +- [Modules with compatible PowerShell Editions][02] + + +[01]: /dotnet/standard/net-standard +[02]: /powershell/gallery/concepts/module-psedition-support +[03]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatiblecommands +[04]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatibletypes +[05]: about_Automatic_Variables.md +[06]: https://devblogs.microsoft.com/powershell/powershell-standard-library-build-single-module-that-works-across-windows-powershell-and-powershell-core/ +[07]: https://github.com/pester/Pester/wiki/Pester +[08]: https://www.powershellgallery.com/packages/PSScriptAnalyzer/ +[09]: xref:Microsoft.PowerShell.Core.Get-Module +[10]: xref:Microsoft.PowerShell.Core.Import-Module diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md index b9caeea26bcc..fb58aca0a92a 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md @@ -1,7 +1,7 @@ --- description: Describes how to use object properties in PowerShell. Locale: en-US -ms.date: 08/21/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_properties?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Properties @@ -133,21 +133,21 @@ Get-ChildItem $PSHOME\pwsh.exe | Format-List -Property * ``` ```Output -PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Program Files\PowerShell\7-preview\pwsh.exe -PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\Program Files\PowerShell\7-preview +PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Program Files\PowerShell\7\pwsh.exe +PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\Program Files\PowerShell\7 PSChildName : pwsh.exe PSDrive : C PSProvider : Microsoft.PowerShell.Core\FileSystem PSIsContainer : False Mode : -a--- ModeWithoutHardLink : -a--- -VersionInfo : File: C:\Program Files\PowerShell\7-preview\pwsh.exe +VersionInfo : File: C:\Program Files\PowerShell\7\pwsh.exe InternalName: pwsh.dll OriginalFilename: pwsh.dll - FileVersion: 7.3.0.5 + FileVersion: 7.3.9.500 FileDescription: pwsh Product: PowerShell - ProductVersion: 7.3.0-preview.5 SHA: cfc237ac85cf24fa760923ace568201c8f3256aa + ProductVersion: 7.3.9 SHA: 116d193ed28dcc6914653c799846bbf379cea0fb Debug: False Patched: False PreRelease: False @@ -156,24 +156,25 @@ VersionInfo : File: C:\Program Files\PowerShell\7-preview\pw Language: Language Neutral BaseName : pwsh -ResolvedTarget : C:\Program Files\PowerShell\7-preview\pwsh.exe +ResolvedTarget : C:\Program Files\PowerShell\7\pwsh.exe Target : LinkType : -Length : 285088 -DirectoryName : C:\Program Files\PowerShell\7-preview -Directory : C:\Program Files\PowerShell\7-preview +Length : 293312 +DirectoryName : C:\Program Files\PowerShell\7 +Directory : C:\Program Files\PowerShell\7 IsReadOnly : False -FullName : C:\Program Files\PowerShell\7-preview\pwsh.exe +FullName : C:\Program Files\PowerShell\7\pwsh.exe Extension : .exe Name : pwsh.exe Exists : True -CreationTime : 6/14/2022 5:17:14 PM -CreationTimeUtc : 6/14/2022 10:17:14 PM -LastAccessTime : 7/18/2022 11:32:06 AM -LastAccessTimeUtc : 7/18/2022 4:32:06 PM -LastWriteTime : 6/14/2022 5:17:14 PM -LastWriteTimeUtc : 6/14/2022 10:17:14 PM +CreationTime : 10/25/2023 7:00:18 PM +CreationTimeUtc : 10/26/2023 12:00:18 AM +LastAccessTime : 11/14/2023 5:14:36 PM +LastAccessTimeUtc : 11/14/2023 11:14:36 PM +LastWriteTime : 10/25/2023 7:00:18 PM +LastWriteTimeUtc : 10/26/2023 12:00:18 AM LinkTarget : +UnixFileMode : -1 Attributes : Archive ``` diff --git a/reference/7.3/PSReadLine/About/about_PSReadLine.md b/reference/7.3/PSReadLine/About/about_PSReadLine.md index 87f4ed465c8f..54521cd57115 100644 --- a/reference/7.3/PSReadLine/About/about_PSReadLine.md +++ b/reference/7.3/PSReadLine/About/about_PSReadLine.md @@ -1,7 +1,7 @@ --- description: PSReadLine provides an improved command-line editing experience in the PowerShell console. Locale: en-US -ms.date: 10/11/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PSReadLine @@ -251,7 +251,7 @@ There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. - Current release is PSReadLine 2.3.4 -- PowerShell 7.4-preview ships with PSReadLine 2.2.6 +- PowerShell 7.4 ships with PSReadLine 2.3.4 - PowerShell 7.3 ships with PSReadLine 2.2.6 - PowerShell 7.2 ships with PSReadLine 2.1.0 - PowerShell 7.0.11 shipped with PSReadLine 2.0.4 diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md index 69b86040c981..3cc542c4f9cd 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -1,7 +1,7 @@ --- description: Combining commands into pipelines in the PowerShell Locale: en-US -ms.date: 06/08/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Pipelines @@ -400,7 +400,7 @@ Piping or redirecting output from a native program that outputs raw byte data converts the output to .NET strings. This conversion can cause corruption of the raw data output. -However, PowerShell 7.4-preview.4 added the `PSNativeCommandPreserveBytePipe` +However, PowerShell 7.4 added the `PSNativeCommandPreserveBytePipe` experimental feature that preserves byte-stream data when redirecting the **stdout** stream of a native command to a file or when piping byte-stream data to the **stdin** stream of a native command. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index 62f581b46d91..92fdd345d79a 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -1,7 +1,7 @@ --- description: Different editions of PowerShell run on different underlying runtimes. Locale: en-US -ms.date: 03/23/2022 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_powershell_editions?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PowerShell Editions @@ -13,26 +13,29 @@ Different editions of PowerShell run on different underlying runtimes. ## Long description -From PowerShell 5.1, there are multiple *editions* of PowerShell that each run on -a different .NET runtime. As of PowerShell 6.0 there are two editions of PowerShell: +From PowerShell 5.1, there are multiple _editions_ of PowerShell that each run +on a different .NET runtime. As of PowerShell 6.0 there are two editions of +PowerShell: - **Desktop**, which runs on .NET Framework. PowerShell 4 and below, as well as - PowerShell 5.1 are available for full-featured Windows editions like Windows Desktop, - Windows Server, Windows Server Core and most other Windows operating systems. This is the original - PowerShell edition and is included in the default installation of the operating system. + PowerShell 5.1 are available for full-featured Windows editions like Windows + Desktop, Windows Server, Windows Server Core and most other Windows operating + systems. This is the original PowerShell edition and is included in the + default installation of the operating system. - **Core**, which runs on .NET Core. PowerShell 6.0 and later is installed - side-by-side with earlier PowerShell releases on full-featured Windows editions, some - reduced-footprint Windows editions such as Windows Nano Server and Windows IoT, or on non-Windows - platforms such as Linux and macOS. + side-by-side with earlier PowerShell releases on full-featured Windows + editions, some reduced-footprint Windows editions such as Windows Nano Server + and Windows IoT, or on non-Windows platforms such as Linux and macOS. -Because the edition of PowerShell corresponds to its .NET runtime, it is the primary indicator -of .NET API and PowerShell module compatibility; some .NET APIs, types or methods are not available -in both .NET runtimes and this affects PowerShell scripts and modules that depend on them. +Because the edition of PowerShell corresponds to its .NET runtime, it is the +primary indicator of .NET API and PowerShell module compatibility; some .NET +APIs, types or methods are not available in both .NET runtimes and this affects +PowerShell scripts and modules that depend on them. ## The `$PSEdition` automatic variable -In PowerShell 5.1 and above, you can find out what edition you are running with the `$PSEdition` -automatic variable: +In PowerShell 5.1 and above, you can find out what edition you are running with +the `$PSEdition` automatic variable: ```powershell $PSEdition @@ -42,12 +45,13 @@ $PSEdition Core ``` -In PowerShell 4 and below, this variable does not exist. `$PSEdition` being null should be treated -as the same as having the value `Desktop`. +In PowerShell 4 and below, this variable does not exist. `$PSEdition` being +null should be treated as the same as having the value `Desktop`. ### Edition in `$PSVersionTable` -The `$PSVersionTable` automatic variable also has **PSEdition** property in PowerShell 5.1 and above: +The `$PSVersionTable` automatic variable also has **PSEdition** property in +PowerShell 5.1 and above: ```powershell $PSVersionTable @@ -56,26 +60,27 @@ $PSVersionTable ```Output Name Value ---- ----- -PSVersion 7.3.0-preview.3 +PSVersion 7.3.9 PSEdition Core -GitCommitId 7.3.0-preview.3 -OS Microsoft Windows 10.0.22000 +GitCommitId 7.3.9 +OS Microsoft Windows 10.0.22621 Platform Win32NT -PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} +PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` -The **PSEdition** field has the same value as the `$PSEdition` automatic variable. +The **PSEdition** field has the same value as the `$PSEdition` automatic +variable. ## The `CompatiblePSEditions` module manifest field -PowerShell modules can declare what editions of PowerShell they are compatible with using the -`CompatiblePSEditions` field of the module manifest. +PowerShell modules can declare what editions of PowerShell they are compatible +with using the `CompatiblePSEditions` field of the module manifest. -For example, a module manifest declaring compatibility with both `Desktop` and `Core` editions -of PowerShell: +For example, a module manifest declaring compatibility with both `Desktop` and +`Core` editions of PowerShell: ```powershell @{ @@ -95,14 +100,14 @@ An example of a module manifest with only `Desktop` compatibility: } ``` -Omitting the `CompatiblePSEditions` field from a module manifest will have the same effect as -setting it to `Desktop`, since modules created before this field was introduced were implicitly -written for this edition. +Omitting the `CompatiblePSEditions` field from a module manifest will have the +same effect as setting it to `Desktop`, since modules created before this field +was introduced were implicitly written for this edition. -For modules not shipped as part of Windows (i.e. modules you write or install from the gallery), -this field is informational only; PowerShell does not change behavior based on the -`CompatiblePSEditions` field, but does expose it on the `PSModuleInfo` object (returned by -`Get-Module`) for your own logic: +For modules not shipped as part of Windows (i.e. modules you write or install +from the gallery), this field is informational only; PowerShell does not change +behavior based on the `CompatiblePSEditions` field, but does expose it on the +`PSModuleInfo` object (returned by `Get-Module`) for your own logic: ```powershell New-ModuleManifest -Path .\TestModuleWithEdition.psd1 -CompatiblePSEditions Desktop,Core -PowerShellVersion '5.1' @@ -116,14 +121,15 @@ Core ``` > [!NOTE] -> The `CompatiblePSEditions` module field is only compatible with PowerShell 5.1 and above. -> Including this field will cause a module to be incompatible with PowerShell 4 and below. -> Since the field is purely informational, it can be safely omitted in later PowerShell versions. +> The `CompatiblePSEditions` module field is only compatible with PowerShell +> 5.1 and above. Including this field will cause a module to be incompatible +> with PowerShell 4 and below. Since the field is purely informational, it can +> be safely omitted in later PowerShell versions. -In PowerShell 6.1, `Get-Module -ListAvailable` has had its formatter updated to display the -edition-compatibility of each module: +In PowerShell 6.1, `Get-Module -ListAvailable` has had its formatter updated to +display the edition-compatibility of each module: -```PowerShell +```powerShell Get-Module -ListAvailable ``` @@ -131,49 +137,52 @@ Get-Module -ListAvailable Directory: C:\Users\me\Documents\PowerShell\Modules -ModuleType Version Name PSEdition ExportedCommands ----------- ------- ---- --------- ---------------- -Script 1.4.0 Az Core,Desk -Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, E... -Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCreden... +ModuleType Version Name PSEdition ExportedCommands +---------- ------- ---- --------- ---------------- +Script 1.4.0 Az Core,Desk +Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, E... +Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCreden... ... -Script 4.4.0 Pester Desk {Describe, Context, It, Should...} -Script 1.18.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-... -Script 1.0.0 WindowsCompatibility Core {Initialize-WinSession, Add-WinFunction, Invoke-WinComm... +Script 4.4.0 Pester Desk {Describe, Context, It, Should...} +Script 1.18.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-... +Script 1.0.0 WindowsCompatibility Core {Initialize-WinSession, Add-WinFunction, Invoke-WinComm... ``` ## Edition-compatibility for modules that ship as part of Windows -For modules that come as part of Windows (or are installed as part of a role or feature), -PowerShell 6.1 and above treat the `CompatiblePSEditions` field differently. Such modules are found -in the Windows PowerShell system modules directory -(`%windir%\System\WindowsPowerShell\v1.0\Modules`). +For modules that come as part of Windows (or are installed as part of a role or +feature), PowerShell 6.1 and above treat the `CompatiblePSEditions` field +differently. Such modules are found in the Windows PowerShell system modules +directory (`%windir%\System\WindowsPowerShell\v1.0\Modules`). -For modules loaded from or found in this directory, PowerShell 6.1 and above uses the -`CompatiblePSEditions` field to determine whether the module will be compatible with the current -session and behaves accordingly. +For modules loaded from or found in this directory, PowerShell 6.1 and above +uses the `CompatiblePSEditions` field to determine whether the module will be +compatible with the current session and behaves accordingly. -When `Import-Module` is used, a module without `Core` in `CompatiblePSEditions` will not be imported -and an error will be displayed: +When `Import-Module` is used, a module without `Core` in `CompatiblePSEditions` +will not be imported and an error will be displayed: ```powershell Import-Module BitsTransfer ``` ```Output -Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1' does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module -SkipEditionCheck' to ignore the compatibility of this module. +Import-Module : Module 'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1' + does not support current PowerShell edition 'Core'. Its supported editions are 'Desktop'. Use 'Import-Module + -SkipEditionCheck' to ignore the compatibility of this module. At line:1 char:1 + Import-Module BitsTransfer + ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026r\BitsTransfer.psd1:String) [Import-Module], InvalidOperationException ++ CategoryInfo : ResourceUnavailable: (C:\WINDOWS\system32\u2026r\BitsTransfer.psd1:String) + [Import-Module], InvalidOperationException + FullyQualifiedErrorId : Modules_PSEditionNotSupported,Microsoft.PowerShell.Commands.ImportModuleCommand ``` -When `Get-Module -ListAvailable` is used, modules without `Core` in `CompatiblePSEditions` will not -be displayed: +When `Get-Module -ListAvailable` is used, modules without `Core` in +`CompatiblePSEditions` will not be displayed: ```powershell Get-Module -ListAvailable BitsTransfer @@ -183,7 +192,8 @@ Get-Module -ListAvailable BitsTransfer # No output ``` -In both cases, the `-SkipEditionCheck` switch parameter can be used to override this behavior: +In both cases, the `-SkipEditionCheck` switch parameter can be used to override +this behavior: ```powershell Get-Module -ListAvailable -SkipEditionCheck BitsTransfer @@ -193,57 +203,68 @@ Get-Module -ListAvailable -SkipEditionCheck BitsTransfer Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules -ModuleType Version Name PSEdition ExportedCommands ----------- ------- ---- --------- ---------------- -Manifest 2.0.0.0 BitsTransfer Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer,... +ModuleType Version Name PSEdition ExportedCommands +---------- ------- ---- --------- ---------------- +Manifest 2.0.0.0 BitsTransfer Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer,... ``` > [!WARNING] -> `Import-Module -SkipEditionCheck` may appear to succeed for a module, but using that module -> runs the risk of encountering an incompatibility later on; while loading the module initially -> succeeds, a command may later call an incompatible API and fail spontaneously. +> `Import-Module -SkipEditionCheck` may appear to succeed for a module, but +> using that module runs the risk of encountering an incompatibility later on; +> while loading the module initially succeeds, a command may later call an +> incompatible API and fail spontaneously. ## Authoring PowerShell modules for edition cross-compatibility -When writing a PowerShell module to target both `Desktop` and `Core` editions of PowerShell, -there are things you can do to ensure cross-edition compatibility. +When writing a PowerShell module to target both `Desktop` and `Core` editions +of PowerShell, there are things you can do to ensure cross-edition +compatibility. -The only true way to confirm and continually validate compatibility however is to write tests for -your script or module and run them on all versions and editions of PowerShell you need compatibility -with. A recommended testing framework for this is [Pester][Pester]. +The only true way to confirm and continually validate compatibility however is +to write tests for your script or module and run them on all versions and +editions of PowerShell you need compatibility with. A recommended testing +framework for this is [Pester][07]. ### PowerShell script -As a language, PowerShell works the same between editions; it is the cmdlets, modules and .NET APIs -you use that are affected by edition compatibility. +As a language, PowerShell works the same between editions; it is the cmdlets, +modules and .NET APIs you use that are affected by edition compatibility. -Generally, scripts that work in PowerShell 6.1 and above will work with Windows PowerShell 5.1, -but there are some exceptions. +Generally, scripts that work in PowerShell 6.1 and above will work with Windows +PowerShell 5.1, but there are some exceptions. -[PSScriptAnalyzer][pssa] version 1.18+ has rules like [PSUseCompatibleCommands][psucc] and -[PSUseCompatibleTypes][psuct] that are able to detect possibly incompatible usage of commands and -.NET APIs in PowerShell scripts. +[PSScriptAnalyzer][08] version 1.18+ has rules like +[PSUseCompatibleCommands][03] and [PSUseCompatibleTypes][04] that are able to +detect possibly incompatible usage of commands and .NET APIs in PowerShell +scripts. ### .NET assemblies -If you are writing a binary module or a module that incorporates .NET assemblies (DLLs) generated -from source code, you should compile against [.NET Standard][netstd] and [PowerShell Standard][psstd] -for compile-time compatibility validation of .NET and PowerShell API compatibility. +If you are writing a binary module or a module that incorporates .NET +assemblies (DLLs) generated from source code, you should compile against +[.NET Standard][01] and [PowerShell Standard][06] for compile-time +compatibility validation of .NET and PowerShell API compatibility. -Although these libraries are able to check some compatibility at compile time, they won't be able -to catch possible behavioral differences between editions. For this you must still write tests. +Although these libraries are able to check some compatibility at compile time, +they won't be able to catch possible behavioral differences between editions. +For this you must still write tests. ## See also -- [about_Automatic_Variables](about_Automatic_Variables.md) -- [Get-Module](xref:Microsoft.PowerShell.Core.Get-Module) -- [Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) -- [Modules with compatible PowerShell Editions](/powershell/gallery/concepts/module-psedition-support) - -[Pester]: https://github.com/pester/Pester/wiki/Pester -[pssa]: https://www.powershellgallery.com/packages/PSScriptAnalyzer/ -[psucc]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatiblecommands -[psuct]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatibletypes -[netstd]: /dotnet/standard/net-standard -[psstd]: https://devblogs.microsoft.com/powershell/powershell-standard-library-build-single-module-that-works-across-windows-powershell-and-powershell-core/ +- [about_Automatic_Variables][05] +- [Get-Module][09] +- [Import-Module][10] +- [Modules with compatible PowerShell Editions][02] + + +[01]: /dotnet/standard/net-standard +[02]: /powershell/gallery/concepts/module-psedition-support +[03]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatiblecommands +[04]: /powershell/utility-modules/psscriptanalyzer/rules/usecompatibletypes +[05]: about_Automatic_Variables.md +[06]: https://devblogs.microsoft.com/powershell/powershell-standard-library-build-single-module-that-works-across-windows-powershell-and-powershell-core/ +[07]: https://github.com/pester/Pester/wiki/Pester +[08]: https://www.powershellgallery.com/packages/PSScriptAnalyzer/ +[09]: xref:Microsoft.PowerShell.Core.Get-Module +[10]: xref:Microsoft.PowerShell.Core.Import-Module diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md index ec20a22a8589..afb0669d7af4 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md @@ -1,7 +1,7 @@ --- description: Explains how to use the `pwsh` command-line interface. Displays the command-line parameters and describes the syntax. Locale: en-US -ms.date: 08/30/2023 +ms.date: 11/14/2023 no-loc: [-File, -f, -Command, -c, -ConfigurationName, -config, -CustomPipeName, -EncodedCommand, -e, -ec, -ExecutionPolicy, -ex, -ep, -InputFormat, -inp, -if, -Interactive, -i, -Login, -l, -MTA, -NoExit, -noe, -NoLogo, -nol, -NonInteractive, -noni, -NoProfile, -nop, -OutputFormat, -o, -of, -SettingsFile, -settings, -SSHServerMode, -sshs, -STA, -Version, -v, -WindowStyle, -w, -WorkingDirectory, -wd, -Help] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pwsh?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -198,7 +198,7 @@ or when execution is interrupted with Ctrl+C. ### -CommandWithArgs | -cwa -This is an experimental feature added in 7.4.0-preview.2. +This is an experimental feature added in 7.4. Executes a PowerShell command with arguments. Unlike `-Command`, this parameter populates the `$args` built-in variable that can be used by the command. diff --git a/reference/7.4/Microsoft.PowerShell.Core/Save-Help.md b/reference/7.4/Microsoft.PowerShell.Core/Save-Help.md index 5a38538af329..375c28c6b6a0 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Save-Help.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Save-Help.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 06/09/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/save-help?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Save-Help @@ -405,8 +405,8 @@ By default, `Save-Help` gets help files in the UI culture set for the operating fallback culture. If you specify the **UICulture** parameter, `Save-Help` only looks for help for the specified language. -Beginning in PowerShell 7.4-preview.4, you can use a partial language code, such as `en` to download -help in English for any region. +Beginning in PowerShell 7.4, you can use a partial language code, such as `en` to download help in +English for any region. ```yaml Type: System.Globalization.CultureInfo[] diff --git a/reference/7.4/Microsoft.PowerShell.Core/Update-Help.md b/reference/7.4/Microsoft.PowerShell.Core/Update-Help.md index 53b14523458c..133586636aeb 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Update-Help.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Update-Help.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 06/09/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/update-help?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Update-Help @@ -472,8 +472,8 @@ By default, `Update-Help` gets help files in the UI culture set for the operatin fallback culture. If you specify the **UICulture** parameter, `Update-Help` only looks for help for the specified language. -Beginning in PowerShell 7.4-preview.4, you can use a partial language code, such as `en` to download -help in English for any region. +Beginning in PowerShell 7.4, you can use a partial language code, such as `en` to download help in +English for any region. > [!NOTE] > Ubuntu 18.04 changed the default locale setting to `C.UTF.8`, which isn't a recognized UI diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Invoke-RestMethod.md b/reference/7.4/Microsoft.PowerShell.Utility/Invoke-RestMethod.md index 77fbb5fcaa43..2d50c6f3760c 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Invoke-RestMethod.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Invoke-RestMethod.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 11/08/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Invoke-RestMethod @@ -499,8 +499,8 @@ contains a host name that requires resolution, and you set **ConnectionTimeoutSe greater than zero, but less than 15 seconds, it can take 15 seconds or more before a **WebException** is thrown, and your request times out. -This parameter replaced the **TimeoutSec** parameter in PowerShell 7.4-preview.4. You can use -**TimeoutSec** as an alias for **ConnectionTimeoutSeconds**. +This parameter replaced the **TimeoutSec** parameter in PowerShell 7.4. You can use **TimeoutSec** +as an alias for **ConnectionTimeoutSeconds**. ```yaml Type: System.Int32 diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Invoke-WebRequest.md b/reference/7.4/Microsoft.PowerShell.Utility/Invoke-WebRequest.md index 57de9dea51ee..0f5d1b53bda7 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Invoke-WebRequest.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Invoke-WebRequest.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 11/08/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Invoke-WebRequest @@ -577,8 +577,8 @@ contains a host name that requires resolution, and you set **ConnectionTimeoutSe greater than zero, but less than 15 seconds, it can take 15 seconds or more before a **WebException** is thrown, and your request times out. -This parameter replaced the **TimeoutSec** parameter in PowerShell 7.4-preview.4. You can use -**TimeoutSec** as an alias for **ConnectionTimeoutSeconds**. +This parameter replaced the **TimeoutSec** parameter in PowerShell 7.4. You can use **TimeoutSec** +as an alias for **ConnectionTimeoutSeconds**. ```yaml Type: System.Int32 diff --git a/reference/7.4/PSReadLine/About/about_PSReadLine.md b/reference/7.4/PSReadLine/About/about_PSReadLine.md index 742b455542a3..56a5f07f2689 100644 --- a/reference/7.4/PSReadLine/About/about_PSReadLine.md +++ b/reference/7.4/PSReadLine/About/about_PSReadLine.md @@ -1,7 +1,7 @@ --- description: PSReadLine provides an improved command-line editing experience in the PowerShell console. Locale: en-US -ms.date: 10/11/2023 +ms.date: 11/14/2023 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about PSReadLine @@ -15,7 +15,7 @@ PowerShell console. ## Long Description -PowerShell 7.3 ships with PSReadLine 2.2.6. The current version is PSReadLine +PowerShell 7.4 ships with PSReadLine 2.3.4. The current version is PSReadLine 2.3.4. The current version of PSReadLine can be installed and used on Windows PowerShell 5.1 and newer. For some features, you need to be running PowerShell 7.2 or higher. @@ -251,7 +251,7 @@ There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. - Current release is PSReadLine 2.3.4 -- PowerShell 7.4-preview ships with PSReadLine 2.2.6 +- PowerShell 7.4 ships with PSReadLine 2.3.4 - PowerShell 7.3 ships with PSReadLine 2.2.6 - PowerShell 7.2 ships with PSReadLine 2.1.0 - PowerShell 7.0.11 shipped with PSReadLine 2.0.4 diff --git a/reference/docs-conceptual/dev-cross-plat/create-feedback-provider.md b/reference/docs-conceptual/dev-cross-plat/create-feedback-provider.md index e1b3f2a1baf7..b34177d38be2 100644 --- a/reference/docs-conceptual/dev-cross-plat/create-feedback-provider.md +++ b/reference/docs-conceptual/dev-cross-plat/create-feedback-provider.md @@ -1,11 +1,11 @@ --- description: This article describes how to create a feedback provider. -ms.date: 09/01/2023 +ms.date: 11/14/2023 title: How to create a feedback provider --- # How to create a feedback provider -PowerShell 7.4-preview.3 introduced the concept of feedback providers. A feedback provider is a +PowerShell 7.4 introduced the concept of feedback providers. A feedback provider is a PowerShell module that implements the `IFeedbackProvider` interface to provide command suggestions based on user command execution attempts. The provider is triggered when there's a success or failure execution. Feedback providers use information from the success or failure to provide @@ -15,20 +15,20 @@ feedback. To create a feedback provider, you must satisfy the following prerequisites: -- Install PowerShell 7.4-preview.3 or higher - - You must enable the `PSFeedbackProvider` experimental feature to enable support for feedback +- Install PowerShell 7.4 or higher + - You must enable the `PSFeedbackProvider` experimental feature to enable support for feedback providers and predictors. For more information, see [Using Experimental Features][02]. -- Install .NET 8 SDK - 8.0-preview.3 or higher +- Install .NET 8 SDK - 8.0.0 or higher - See the [Download .NET 8.0][09] page to get the latest version of the SDK. ## Overview of a feedback provider A feedback provider is a PowerShell binary module that implements the -`System.Management.Automation.Subsystem.Feedback.IFeedbackProvider` interface. This interface -declares the methods to get feedback based on the command line input. The feedback interface can -provide suggestions based on the success or failure of the command invoked by the user. The -suggestions can be anything that you want. For example, you might suggest ways to address an -error or better practices, like avoiding the use of aliases. For more information, see the +`System.Management.Automation.Subsystem.Feedback.IFeedbackProvider` interface. This interface +declares the methods to get feedback based on the command line input. The feedback interface can +provide suggestions based on the success or failure of the command invoked by the user. The +suggestions can be anything that you want. For example, you might suggest ways to address an +error or better practices, like avoiding the use of aliases. For more information, see the [What are Feedback Providers?][08] blog post. The following diagram shows the architecture of a feedback provider: @@ -193,7 +193,7 @@ internal myFeedbackProvider(string guid) The `GetFeedback` method takes two parameters, `context` and `token`. The `context` parameter receives the information about the trigger so you can decide how to respond with suggestions. The `token` parameter is used for cancellation. This function returns a `FeedbackItem` containing the -suggestion. +suggestion. ```csharp /// @@ -277,7 +277,7 @@ The `TryGetAlias()` method is a private helper function that returns a boolean v whether the command is an alias. In the class constructor, we created a PowerShell instance that we can use to run PowerShell commands. The `TryGetAlias()` method uses this PowerShell instance to invoke the `GetCommand` method to determine if the command is an alias. The `AliasInfo` object -returned by `GetCommand` contains full name of the aliased command. +returned by `GetCommand` contains full name of the aliased command. ```csharp /// @@ -422,7 +422,7 @@ dotnet build This command create the PowerShell module as a DLL file in the following path of your project folder: `bin/Debug/net8.0/myFeedbackProvider` -You may run into the error `error NU1101: Unable to find package System.Management.Automation.` +You may run into the error `error NU1101: Unable to find package System.Management.Automation.` when building on Windows machines. To fix this add a `nuget.config` file to your project directory and add the following: @@ -476,7 +476,7 @@ The following screenshot shows some example suggestions from the new provider. The following is a GIF showing how the predictor integration works from the new provider. -![GIF of predictor system working with feedback provider][10] +![GIF of predictor system working with feedback provider][10] ## Other feedback providers @@ -484,17 +484,17 @@ We have created other feedback provider that can be used as a good reference for ### command-not-found -The `command-not-found` feedback provider utilizes the `command-not-found` utility tool on Linux systems -to provide suggestions when native commands are attempted to run but are missing. You can find the code +The `command-not-found` feedback provider utilizes the `command-not-found` utility tool on Linux systems +to provide suggestions when native commands are attempted to run but are missing. You can find the code in the [GitHub Repository][11] or can download for yourself on the [PowerShell Gallery][12]. ### PowerShell Adapter -The `Microsoft.PowerShell.PowerShellAdapter` is a feedback provider that helps you convert text outputs +The `Microsoft.PowerShell.PowerShellAdapter` is a feedback provider that helps you convert text outputs from native commands into PowerShell objects. It detects "adapters" on your system and suggests you to use -them when you use the native command. You can learn more about PowerShell Adapters from, -[PowerShell Adapter Feedback Provider][13] blog post. You can also find teh code in the [GitHub Repository][14] -or can download for yourself on the [PowerShell Gallery][15]. +them when you use the native command. You can learn more about PowerShell Adapters from, +[PowerShell Adapter Feedback Provider][13] blog post. You can also find teh code in the [GitHub Repository][14] +or can download for yourself on the [PowerShell Gallery][15]. ## Appendix - Full implementation code diff --git a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md index 4a718579d676..9b9ffaf942a3 100644 --- a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md +++ b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md @@ -1,6 +1,6 @@ --- description: Details the policies governing support for PowerShell -ms.date: 09/02/2023 +ms.date: 11/14/2023 title: PowerShell Support Lifecycle --- # PowerShell Support Lifecycle @@ -24,7 +24,7 @@ the next release (current or LTS). > [!IMPORTANT] > You must have the latest patch update installed to qualify for support. For example, if you're -> running PowerShell 7.3 and 7.3.1 has been released, you must update to 7.3.1 to qualify for +> running PowerShell 7.4.0 and 7.4.1 has been released, you must update to 7.4.1 to qualify for > support. ## Supported platforms @@ -106,11 +106,11 @@ support options. Based on these lifecycle policies, the following table lists the dates when support for the current versions of PowerShell end: -| Version | Release Date | End-of-support | -| ----------------- | ---------------- | ---------------- | -| 7.4 (preview) | TBD | TBD | -| 7.3 (Stable) | November 9, 2022 | May 8, 2024 | -| 7.2 (LTS-current) | November 8, 2021 | November 8, 2024 | +| Version | Release Date | End-of-support | +| ------------------ | ----------------- | ---------------- | +| 7.4 (LTS-current) | November 16, 2023 | May 15, 2025 | +| 7.3 (Stable) | November 9, 2022 | May 8, 2024 | +| 7.2 (LTS-previous) | November 8, 2021 | November 8, 2024 | Support for PowerShell on a specific platform is based on the support policy of the version of .NET used. @@ -135,7 +135,7 @@ for historical reference. It isn't intended for use to determine the support lif | Version | Release Date | Note | | ---------------------------- | :----------: | ------------------------------------------------------------------------------- | -| PowerShell 7.4 (preview) | | Built on .NET 8.0.0-preview | +| PowerShell 7.4 (preview) | Nov-2023 | Built on .NET 8.0.0 | | PowerShell 7.3 | Nov-2022 | Built on .NET 7.0 | | PowerShell 7.2 (LTS-current) | Nov-2021 | Built on .NET 6.0 (LTS-current) | | PowerShell 7.1 | Nov-2020 | Built on .NET 5.0 | diff --git a/reference/docs-conceptual/install/install-debian.md b/reference/docs-conceptual/install/install-debian.md index d57adfa13880..bb12c7fc7fa8 100644 --- a/reference/docs-conceptual/install/install-debian.md +++ b/reference/docs-conceptual/install/install-debian.md @@ -1,13 +1,13 @@ --- description: Information about installing PowerShell on Debian Linux -ms.date: 10/25/2023 +ms.date: 11/14/2023 title: Installing PowerShell on Debian --- # Installing PowerShell on Debian All packages are available on our GitHub [releases][02] page. Before installing, check the list of [Supported versions][01] below. After the package is installed, run -`pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +`pwsh` from a terminal. Run `pwsh-lts` if you installed a preview release. > [!NOTE] > PowerShell 7.3 is an in-place upgrade that removes previous versions of PowerShell 7. Preview @@ -69,12 +69,12 @@ package from the [releases][02] page onto your Debian machine. The link to the current version is: +- PowerShell 7.4 universal package for supported versions of Debian + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-lts_7.4.0-1.deb_amd64.deb` - PowerShell 7.3.9 universal package for supported versions of Debian - `https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/powershell_7.3.9-1.deb_amd64.deb` - PowerShell 7.2.16 universal package for supported versions of Debian - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.16/powershell-lts_7.2.16-1.deb_amd64.deb` -- PowerShell 7.4-rc.1 universal package for supported versions of Debian - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.0-rc.1/powershell-preview_7.4.0-rc.1-1.deb_amd64.deb` The following shell script downloads and installs the current preview release of PowerShell. You can change the URL to download a the version of PowerShell you want to install. @@ -90,20 +90,20 @@ sudo apt-get update sudo apt-get install -y wget # Download the PowerShell package file -wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0-rc.1/powershell-preview_7.4.0-rc.1-1.deb_amd64.deb +wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-lts_7.4.0-1.deb_amd64.deb ################################### # Install the PowerShell package -sudo dpkg -i powershell-preview_7.4.0-rc.1-1.deb_amd64.deb +sudo dpkg -i powershell-lts_7.4.0-1.deb_amd64.deb # Resolve missing dependencies and finish the install (if necessary) sudo apt-get install -f # Delete the downloaded package file -rm powershell-preview_7.4.0-rc.1-1.deb_amd64.deb +rm powershell-lts_7.4.0-1.deb_amd64.deb # Start PowerShell Preview -pwsh-preview +pwsh-lts ``` ## Uninstall PowerShell diff --git a/reference/docs-conceptual/install/install-rhel.md b/reference/docs-conceptual/install/install-rhel.md index b21eeca2ee8b..b056c07d162e 100644 --- a/reference/docs-conceptual/install/install-rhel.md +++ b/reference/docs-conceptual/install/install-rhel.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on Red Hat Enterprise Linux (RHEL) -ms.date: 10/25/2023 +ms.date: 11/14/2023 title: Installing PowerShell on Red Hat Enterprise Linux (RHEL) --- # Installing PowerShell on Red Hat Enterprise Linux (RHEL) @@ -73,12 +73,12 @@ package from the [releases][02] page onto your RHEL machine. The link to the current version is: +- PowerShell 7.4 universal package for supported versions of RHEL + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-lts-7.4.0-1.rh.x86_64.rpm` - PowerShell 7.3.9 universal package for supported versions of RHEL -- `https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/powershell-7.3.9-1.rh.x86_64.rpm` + - `https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/powershell-7.3.9-1.rh.x86_64.rpm` - PowerShell 7.2.16 universal package for supported versions of RHEL -- `https://github.com/PowerShell/PowerShell/releases/download/v7.2.16/powershell-lts-7.2.16-1.rh.x86_64.rpm` -- PowerShell 7.4-rc.1 universal package for supported versions of RHEL - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.0-rc.1/powershell-preview-7.4.0_preview.5-1.rh.x86_64.rpm` + - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.16/powershell-lts-7.2.16-1.rh.x86_64.rpm` The following shell script downloads and installs the current preview release of PowerShell. You can change the URL to download a the version of PowerShell you want to install. diff --git a/reference/docs-conceptual/install/install-ubuntu.md b/reference/docs-conceptual/install/install-ubuntu.md index b586eb46c85e..1235383de383 100644 --- a/reference/docs-conceptual/install/install-ubuntu.md +++ b/reference/docs-conceptual/install/install-ubuntu.md @@ -1,13 +1,13 @@ --- description: Information about installing PowerShell on Ubuntu -ms.date: 10/25/2023 +ms.date: 11/14/2023 title: Installing PowerShell on Ubuntu --- # Installing PowerShell on Ubuntu All packages are available on our GitHub [releases][02] page. Before installing, check the list of [Supported versions][01] below. After the package is installed, run -`pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +`pwsh` from a terminal. Run `pwsh-lts` if you installed a preview release. > [!NOTE] > PowerShell 7.3 is an in-place upgrade that removes previous versions of PowerShell 7. Preview @@ -81,12 +81,12 @@ package from the [releases][02] page onto your Ubuntu machine. The link to the current version is: +- PowerShell 7.4 universal package for supported versions of Ubuntu + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-lts_7.4.0-1.deb_amd64.deb` - PowerShell 7.3.9 universal package for supported versions of Ubuntu - `https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/powershell_7.3.9-1.deb_amd64.deb` - PowerShell 7.2.16 universal package for supported versions of Ubuntu - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.16/powershell-lts_7.2.16-1.deb_amd64.deb` -- PowerShell 7.4-rc.1 universal package for supported versions of Ubuntu - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.0-rc.1/powershell-preview_7.4.0-rc.1-1.deb_amd64.deb` The following shell script downloads and installs the current preview release of PowerShell. You can change the URL to download a the version of PowerShell you want to install. @@ -102,20 +102,20 @@ sudo apt-get update sudo apt-get install -y wget # Download the PowerShell package file -wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0-rc.1/powershell-preview_7.4.0-rc.1-1.deb_amd64.deb +wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/powershell-lts_7.4.0-1.deb_amd64.deb ################################### # Install the PowerShell package -sudo dpkg -i powershell-preview_7.4.0-rc.1-1.deb_amd64.deb +sudo dpkg -i powershell-lts_7.4.0-1.deb_amd64.deb # Resolve missing dependencies and finish the install (if necessary) sudo apt-get install -f # Delete the downloaded package file -rm powershell-preview_7.4.0-rc.1-1.deb_amd64.deb +rm powershell-lts_7.4.0-1.deb_amd64.deb # Start PowerShell Preview -pwsh-preview +pwsh-lts ``` ## Uninstall PowerShell diff --git a/reference/docs-conceptual/learn/application-control.md b/reference/docs-conceptual/learn/application-control.md index 7f3042f744f0..9f7c1f5df3f0 100644 --- a/reference/docs-conceptual/learn/application-control.md +++ b/reference/docs-conceptual/learn/application-control.md @@ -1,6 +1,6 @@ --- description: You can secure your PowerShell environments on Windows using Windows Defender Application Control (WDAC). -ms.date: 05/23/2023 +ms.date: 11/14/2023 title: Using Windows Defender Application Control --- # Using Windows Defender Application Control @@ -38,11 +38,11 @@ correctly in Constrained Language mode. ## WDAC policy auditing -PowerShell 7.4-preview.4 added a new experimental feature, `PSConstrainedAuditLogging`. When you -enable this feature, PowerShell supports WDAC policies in **Audit** mode. In audit mode, PowerShell -runs the untrusted scripts in Constrained Language mode without errors, but logs messages to the -event log instead. The log messages describe what restrictions would apply if the policy was in -**Enforce** mode. +PowerShell 7.4 added a new experimental feature, `PSConstrainedAuditLogging`. When you enable this +feature, PowerShell supports WDAC policies in **Audit** mode. In audit mode, PowerShell runs the +untrusted scripts in Constrained Language mode without errors, but logs messages to the event log +instead. The log messages describe what restrictions would apply if the policy was in **Enforce** +mode. ### Viewing audit events diff --git a/reference/docs-conceptual/learn/experimental-features.md b/reference/docs-conceptual/learn/experimental-features.md index 4d8256871033..9325590702f5 100644 --- a/reference/docs-conceptual/learn/experimental-features.md +++ b/reference/docs-conceptual/learn/experimental-features.md @@ -1,6 +1,6 @@ --- description: Lists the currently available experimental features and how to use them. -ms.date: 09/29/2023 +ms.date: 11/14/2023 title: Using Experimental Features in PowerShell --- # Using Experimental Features in PowerShell @@ -112,8 +112,10 @@ This feature was added in PowerShell 7.4-preview.2. ## PSConstrainedAuditLogging + + > [!NOTE] -> This feature became mainstream in PowerShell 7.4-preview.6. +> This feature became mainstream in PowerShell 7.4. On Windows, when PowerShell runs under a Windows Defender Application Control (WDAC) policy, it changes its behavior based on the defined security policy. Under a WDAC policy, PowerShell runs @@ -131,8 +133,10 @@ This feature was added in PowerShell 7.4-preview.4. ## PSCustomTableHeaderLabelDecoration + + > [!NOTE] -> This feature became mainstream in PowerShell 7.4-preview.6. +> This feature became mainstream in PowerShell 7.4. When you enable this feature, `$PSStyle` includes formatting differentiation for table header labels that aren't property members. For example, the default output from `Get-Process` includes the @@ -188,6 +192,8 @@ This feature includes two built-in feedback providers: in an interactive run, and for providing predictive IntelliSense results for the next command line. +This feature was added in PowerShell 7.4-preview.3. + ## PSLoadAssemblyFromNativeCode Exposes an API to allow assembly loading from native code. @@ -201,6 +207,8 @@ modules between machines should mark the module folder as **Pinned** or the equi providers other than OneDrive. Marking the module folder as **Pinned** ensures that the files are always kept on disk. +This feature was added in PowerShell 7.4-preview.1. + ## PSNativeCommandArgumentPassing > [!NOTE] @@ -277,8 +285,10 @@ information, see [Trace-Command][13]. ## PSNativeCommandErrorActionPreference + + > [!NOTE] -> This feature became mainstream in PowerShell 7.4-preview.6. +> This feature became mainstream in PowerShell 7.4. Native commands usually return an exit code to the calling application that's zero for success or non-zero for failure. However, native commands currently don't participate in the PowerShell error @@ -318,8 +328,10 @@ set to `$true` you get the following behavior: ## PSNativeCommandPreserveBytePipe + + > [!NOTE] -> This feature became mainstream in PowerShell 7.4-preview.6. +> This feature became mainstream in PowerShell 7.4. This feature preserves the byte-stream data when redirecting the **stdout** stream of a native command to a file or when piping byte-stream data to the **stdin** stream of a native command. @@ -357,7 +369,7 @@ following examples use `Invoke-WebRequest` to download the same TAR file as the This feature doesn't support byte-stream data when redirecting **stderr** output to **stdout**. When you combine the **stderr** and **stdout** streams, the combined streams are treated as string data. -This experimental feature was introduced in PowerShell 7.4-preview.4. +This experimental feature was added in PowerShell 7.4-preview.4. ## PSNativePSPathResolution @@ -393,8 +405,10 @@ on the system. ## PSWindowsNativeCommandArgPassing + + > [!NOTE] -> This feature became mainstream in PowerShell 7.4-preview.6. +> This feature became mainstream in PowerShell 7.4. The feature changes the default values of the `$PSNativeCommandArgumentPassing` variable. diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md index b78cfda64fa1..d78c9cf38b3d 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md @@ -1,13 +1,13 @@ --- title: What's New in PowerShell 7.4 (preview) description: New features and changes released in PowerShell 7.4 (preview) -ms.date: 10/25/2023 +ms.date: 11/14/2023 --- # What's New in PowerShell 7.4 (preview) -PowerShell 7.4-rc.1 includes the following features, updates, and breaking changes. PowerShell -7.4 is now built on .NET 8.0.0-rc.2. +PowerShell 7.4 includes the following features, updates, and breaking changes. PowerShell 7.4 is +built on .NET 8.0.0. For a complete list of changes, see the [CHANGELOG][15] in the GitHub repository. @@ -29,12 +29,12 @@ For more information, see [Install the msi package from the command line][01]. ## Updated versions of PSResourceGet and PSReadLine -PowerShell 7.4-rc.1 now includes **Microsoft.PowerShell.PSResourceGet** v1.0.0. This module is -installed side-by-side with **PowerShellGet** v2.2.5 and **PackageManagement** v1.4.8.1. For more -information, see the documentation for [Microsoft.PowerShell.PSResourceGet][14]. +PowerShell 7.4 includes **Microsoft.PowerShell.PSResourceGet** v1.0.1. This module is installed +side-by-side with **PowerShellGet** v2.2.5 and **PackageManagement** v1.4.8.1. For more information, +see the documentation for [Microsoft.PowerShell.PSResourceGet][14]. -PowerShell 7.4-rc.1 now includes **PSReadLine** v2.3.4. For more information, see the documentation -for [PSReadLine][13]. +PowerShell 7.4 now includes **PSReadLine** v2.3.4. For more information, see the documentation for +[PSReadLine][13]. ## Tab completion improvements diff --git a/reference/includes/alpine-support.md b/reference/includes/alpine-support.md index 210d749cd505..4e0cb003a4a6 100644 --- a/reference/includes/alpine-support.md +++ b/reference/includes/alpine-support.md @@ -1,7 +1,7 @@ --- author: sdwheeler ms.author: sewhee -ms.date: 10/26/2023 +ms.date: 11/14/2023 ms.prod: powershell ms.topic: include --- @@ -24,7 +24,7 @@ supported on. These versions are supported until either the version of [3]: ../media/shared/cross-mark-274c.svg [4]: ../media/shared/large-yellow-circle-1f7e1.svg -| Alpine | 7.2 (LTS-current) | 7.3 | 7.4 (preview) | +| Alpine | 7.2 (LTS-previous) | 7.3 | 7.4 (LTS-current) | | :-----------------------: | :------------------: | :------------------: | :------------------: | | ![Supported][1] 3.18 | ![Not Supported][3] | ![Not Supported][3] | ![Not Supported][3] | | ![Supported][1] 3.17 | ![In Test][2] | ![In Test][2] | ![In Test][2] | diff --git a/reference/includes/debian-support.md b/reference/includes/debian-support.md index 1288ba3cdbf8..c555f03ffe6c 100644 --- a/reference/includes/debian-support.md +++ b/reference/includes/debian-support.md @@ -1,7 +1,7 @@ --- author: sdwheeler ms.author: sewhee -ms.date: 10/26/2023 +ms.date: 11/14/2023 ms.prod: powershell ms.topic: include --- @@ -24,7 +24,7 @@ they're supported on. These versions remain supported until either the version o [3]: ../media/shared/cross-mark-274c.svg [4]: ../media/shared/large-yellow-circle-1f7e1.svg -| Debian | 7.2 (LTS-current) | 7.3 | 7.4 (preview) | +| Debian | 7.2 (LTS-previous) | 7.3 | 7.4 (LTS-current) | | -------------------------------- | :------------------: | :------------------: | :------------------: | | ![Supported][1] 12 (Bookworm) | ![In Test][2] | ![In Test][2] | ![In Test][2] | | ![Supported][1] 11 (Bullseye) | ![Supported][1] | ![Supported][1] | ![Supported][1] | diff --git a/reference/includes/macos-support.md b/reference/includes/macos-support.md index e9152cc7f227..0aad609ba6f3 100644 --- a/reference/includes/macos-support.md +++ b/reference/includes/macos-support.md @@ -1,7 +1,7 @@ --- author: sdwheeler ms.author: sewhee -ms.date: 10/26/2023 +ms.date: 11/14/2023 ms.prod: powershell ms.topic: include --- @@ -23,12 +23,12 @@ macOS. These versions remain supported until either the version of [3]: ../media/shared/cross-mark-274c.svg [4]: ../media/shared/large-yellow-circle-1f7e1.svg -| macOS | 7.2 (LTS-current) | 7.3 | 7.4 (preview) | -| ----------------------------- | :---------------: | :-------------: | :-------------: | -| ![Supported][1] 14 (Sonoma) | ![In Test][2] | ![In Test][2] | ![In Test][2] | -| ![Supported][1] 13 (Ventura) | ![In Test][2] | ![In Test][2] | ![In Test][2] | -| ![Supported][1] 12 (Monterey) | ![In Test][2] | ![In Test][2] | ![In Test][2] | -| ![Supported][1] 11 (Big Sur) | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| macOS | 7.2 (LTS-previous) | 7.3 | 7.4 (LTS-current) | +| ----------------------------- | :----------------: | :-------------: | :---------------: | +| ![Supported][1] 14 (Sonoma) | ![In Test][2] | ![In Test][2] | ![In Test][2] | +| ![Supported][1] 13 (Ventura) | ![In Test][2] | ![In Test][2] | ![In Test][2] | +| ![Supported][1] 12 (Monterey) | ![In Test][2] | ![In Test][2] | ![In Test][2] | +| ![Supported][1] 11 (Big Sur) | ![Supported][1] | ![Supported][1] | ![Supported][1] | Support of macOS is defined by Apple. For more information, see the following: diff --git a/reference/includes/rhel-support.md b/reference/includes/rhel-support.md index 693da0543fa6..abecd55c37ac 100644 --- a/reference/includes/rhel-support.md +++ b/reference/includes/rhel-support.md @@ -1,7 +1,7 @@ --- author: sdwheeler ms.author: sewhee -ms.date: 10/26/2023 +ms.date: 11/14/2023 ms.prod: powershell ms.topic: include --- @@ -24,11 +24,11 @@ they're supported on. These versions remain supported until either the version o [3]: ../media/shared/cross-mark-274c.svg [4]: ../media/shared/large-yellow-circle-1f7e1.svg -| RHEL | 7.2 (LTS-current) | 7.3 | 7.4 (preview) | -| ----------------- | :---------------: | :-------------: | :-----------------: | -| ![Supported][1] 9 | ![Supported][1] | ![Supported][1] | ![Supported][1] | -| ![Supported][1] 8 | ![Supported][1] | ![Supported][1] | ![Supported][1] | -| ![Supported][1] 7 | ![Supported][1] | ![Supported][1] | ![Not Supported][3] | +| RHEL | 7.2 (LTS-previous) | 7.3 | 7.4 (LTS-current) | +| ----------------- | :----------------: | :-------------: | :-----------------: | +| ![Supported][1] 9 | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| ![Supported][1] 8 | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| ![Supported][1] 7 | ![Supported][1] | ![Supported][1] | ![Not Supported][3] | PowerShell is tested on Red Hat Universal Base Images (UBI). For more information, see the [UBI information page][ubi]. diff --git a/reference/includes/ubuntu-support.md b/reference/includes/ubuntu-support.md index ae7847dc2049..45c02449a39e 100644 --- a/reference/includes/ubuntu-support.md +++ b/reference/includes/ubuntu-support.md @@ -24,7 +24,7 @@ Ubuntu they're supported on. These versions remain supported until either the ve [3]: ../media/shared/cross-mark-274c.svg [4]: ../media/shared/large-yellow-circle-1f7e1.svg -| Ubuntu | 7.2 (LTS-current) | 7.3 | 7.4 (preview) | +| Ubuntu | 7.2 (LTS-previous) | 7.3 | 7.4 (LTS-current) | | --------------------------------------- | :------------------: | :------------------: | :------------------: | | ![Supported][1] 22.04 LTS (Jammy) | ![Supported][1] | ![Supported][1] | ![Supported][1] | | ![Supported][1] 20.04 LTS (Focal) | ![Supported][1] | ![Supported][1] | ![Supported][1] | diff --git a/reference/includes/windows-support.md b/reference/includes/windows-support.md index dc8a41011171..2f6fc4b7079f 100644 --- a/reference/includes/windows-support.md +++ b/reference/includes/windows-support.md @@ -24,12 +24,12 @@ on. These versions are supported until either the version of [3]: ../media/shared/cross-mark-274c.svg [4]: ../media/shared/large-yellow-circle-1f7e1.svg -| Windows | 7.2 (LTS-current) | 7.3 | 7.4 (preview) | -| ---------------------------------------------------- | :---------------: | :-------------: | :-------------: | -| ![Supported][1] Windows Server 2016, 2019, or 2022 | ![Supported][1] | ![Supported][1] | ![Supported][1] | -| ![Supported][1] Windows Server Nano (1809 or higher) | ![Supported][1] | ![Supported][1] | ![Supported][1] | -| ![Supported][1] Windows 11 | ![Supported][1] | ![Supported][1] | ![Supported][1] | -| ![Supported][1] Windows 10 1607+ | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| Windows | 7.2 (LTS-previous) | 7.3 | 7.4 (LTS-current) | +| ---------------------------------------------------- | :----------------: | :-------------: | :---------------: | +| ![Supported][1] Windows Server 2016, 2019, or 2022 | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| ![Supported][1] Windows Server Nano (1809 or higher) | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| ![Supported][1] Windows 11 | ![Supported][1] | ![Supported][1] | ![Supported][1] | +| ![Supported][1] Windows 10 1607+ | ![Supported][1] | ![Supported][1] | ![Supported][1] | > [!NOTE] > Support for a specific version of Windows is determined by the Microsoft Support Lifecycle From 6be9566b7ef0be958f4c0d92aadd9161180e5a90 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Wed, 15 Nov 2023 09:18:27 -0600 Subject: [PATCH 2/2] Define script files as script blocks --- .../About/about_Automatic_Variables.md | 6 +-- .../About/about_Script_Blocks.md | 43 +++++++++++-------- .../About/about_Automatic_Variables.md | 6 +-- .../About/about_Script_Blocks.md | 43 +++++++++++-------- .../About/about_Automatic_Variables.md | 6 +-- .../About/about_Script_Blocks.md | 43 +++++++++++-------- .../About/about_Automatic_Variables.md | 6 +-- .../About/about_Script_Blocks.md | 43 +++++++++++-------- 8 files changed, 116 insertions(+), 80 deletions(-) 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 ea9a8ec3918c..58aea9408d86 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,7 +1,7 @@ --- description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell. Locale: en-US -ms.date: 10/26/2023 +ms.date: 11/15/2023 no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline] 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 @@ -231,8 +231,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 and script blocks (which -are unnamed functions). +The `$input` variable is available only to functions, script blocks (which +are unnamed functions), and script files (which are saved script blocks). - In a function without a `begin`, `process`, or `end` block, the `$input` variable enumerates the collection of all input to the function. 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 a2aed24094c8..30f7e861fe78 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/29/2022 +ms.date: 11/15/2023 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 @@ -15,9 +15,11 @@ the PowerShell programming language. ## Long description -In the PowerShell programming language, a script block is a -collection of statements or expressions that can be used as a single unit. -A script block can accept arguments and return values. +In the PowerShell programming language, a script block 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. You can also pass a script block to a A script block can accept +arguments and return values. Syntactically, a script block is a statement list in braces, as shown in the following syntax: @@ -30,27 +32,27 @@ A script block returns the output of all the commands in the script block, either as a single object or as an array. You can also specify a return value using the `return` keyword. The `return` -keyword does not affect or suppress other output returned from your script +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](about_Return.md). +more information, see [about_Return][04]. Like functions, a script block can include parameters. Use the Param keyword to assign named parameters, as shown in the following syntax: ``` { -Param([type]$Parameter1 [,[type]$Parameter2]) - + Param([type]$Parameter1 [,[type]$Parameter2]) + } ``` > [!NOTE] -> In a script block, unlike a function, you cannot specify parameters outside +> In a script block, unlike a function, you can't specify parameters outside > the braces. Like functions, script blocks can include the `DynamicParam`, `Begin`, -`Process`, and `End` keywords. For more information, see [about_Functions](about_Functions.md) -and [about_Functions_Advanced](about_Functions_Advanced.md). +`Process`, and `End` keywords. For more information, see [about_Functions][02] +and [about_Functions_Advanced][01]. ## Using Script Blocks @@ -92,7 +94,7 @@ 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](about_Splatting.md#splatting-with-arrays). +[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`. @@ -143,7 +145,7 @@ PS> $b 2 ``` -For more information about the call operator, see [about_Operators](about_Operators.md). +For more information about the call operator, see [about_Operators][03]. ## Using delay-bind script blocks with parameters @@ -171,7 +173,7 @@ Notes on delay-bind script blocks as parameters: - You must explicitly specify any parameter names you use with delay-bind script blocks. -- The parameter must not be untyped, and the parameter's type cannot be +- 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 pipeline input. @@ -195,6 +197,13 @@ Notes on delay-bind script blocks as parameters: ## See also -- [about_Functions](about_Functions.md) -- [about_Functions_Advanced](about_Functions_Advanced.md) -- [about_Operators](about_Operators.md) +- [about_Functions][02] +- [about_Functions_Advanced][01] +- [about_Operators][03] + + +[01]: about_Functions_Advanced.md +[02]: about_Functions.md +[03]: about_Operators.md +[04]: about_Return.md +[05]: about_Splatting.md#splatting-with-arrays diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index 9944b5e6dc1b..0013b74d4e5c 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -1,7 +1,7 @@ --- description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell. Locale: en-US -ms.date: 10/26/2023 +ms.date: 11/15/2023 no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -244,8 +244,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 and script blocks (which -are unnamed functions). +The `$input` variable is available only to functions, script blocks (which +are unnamed functions), and script files (which are saved script blocks). - In a function without a `begin`, `process`, or `end` block, the `$input` variable enumerates the collection of all input to the function. diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Script_Blocks.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Script_Blocks.md index 4e1c205aad7d..4d7ce0f278b2 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Script_Blocks.md +++ b/reference/7.2/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/29/2022 +ms.date: 11/15/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Script Blocks @@ -15,9 +15,11 @@ the PowerShell programming language. ## Long description -In the PowerShell programming language, a script block is a -collection of statements or expressions that can be used as a single unit. -A script block can accept arguments and return values. +In the PowerShell programming language, a script block 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. You can also pass a script block to a A script block can accept +arguments and return values. Syntactically, a script block is a statement list in braces, as shown in the following syntax: @@ -30,27 +32,27 @@ A script block returns the output of all the commands in the script block, either as a single object or as an array. You can also specify a return value using the `return` keyword. The `return` -keyword does not affect or suppress other output returned from your script +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](about_Return.md). +more information, see [about_Return][04]. Like functions, a script block can include parameters. Use the Param keyword to assign named parameters, as shown in the following syntax: ``` { -Param([type]$Parameter1 [,[type]$Parameter2]) - + Param([type]$Parameter1 [,[type]$Parameter2]) + } ``` > [!NOTE] -> In a script block, unlike a function, you cannot specify parameters outside +> In a script block, unlike a function, you can't specify parameters outside > the braces. Like functions, script blocks can include the `DynamicParam`, `Begin`, -`Process`, and `End` keywords. For more information, see [about_Functions](about_Functions.md) -and [about_Functions_Advanced](about_Functions_Advanced.md). +`Process`, and `End` keywords. For more information, see [about_Functions][02] +and [about_Functions_Advanced][01]. ## Using Script Blocks @@ -92,7 +94,7 @@ 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](about_Splatting.md#splatting-with-arrays). +[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`. @@ -143,7 +145,7 @@ PS> $b 2 ``` -For more information about the call operator, see [about_Operators](about_Operators.md). +For more information about the call operator, see [about_Operators][03]. ## Using delay-bind script blocks with parameters @@ -171,7 +173,7 @@ Notes on delay-bind script blocks as parameters: - You must explicitly specify any parameter names you use with delay-bind script blocks. -- The parameter must not be untyped, and the parameter's type cannot be +- 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 pipeline input. @@ -195,6 +197,13 @@ Notes on delay-bind script blocks as parameters: ## See also -- [about_Functions](about_Functions.md) -- [about_Functions_Advanced](about_Functions_Advanced.md) -- [about_Operators](about_Operators.md) +- [about_Functions][02] +- [about_Functions_Advanced][01] +- [about_Operators][03] + + +[01]: about_Functions_Advanced.md +[02]: about_Functions.md +[03]: about_Operators.md +[04]: about_Return.md +[05]: about_Splatting.md#splatting-with-arrays diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index ce10ddfc78ee..590ef235f58c 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -1,7 +1,7 @@ --- description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell. Locale: en-US -ms.date: 10/26/2023 +ms.date: 11/15/2023 no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -244,8 +244,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 and script blocks (which -are unnamed functions). +The `$input` variable is available only to functions, script blocks (which +are unnamed functions), and script files (which are saved script blocks). - In a function without a `begin`, `process`, or `end` block, the `$input` variable enumerates the collection of all input to the function. diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Script_Blocks.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Script_Blocks.md index 1af76a6b7dae..0730225bcf99 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Script_Blocks.md +++ b/reference/7.3/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/29/2022 +ms.date: 11/15/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Script Blocks @@ -15,9 +15,11 @@ the PowerShell programming language. ## Long description -In the PowerShell programming language, a script block is a -collection of statements or expressions that can be used as a single unit. -A script block can accept arguments and return values. +In the PowerShell programming language, a script block 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. You can also pass a script block to a A script block can accept +arguments and return values. Syntactically, a script block is a statement list in braces, as shown in the following syntax: @@ -30,27 +32,27 @@ A script block returns the output of all the commands in the script block, either as a single object or as an array. You can also specify a return value using the `return` keyword. The `return` -keyword does not affect or suppress other output returned from your script +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](about_Return.md). +more information, see [about_Return][04]. Like functions, a script block can include parameters. Use the Param keyword to assign named parameters, as shown in the following syntax: ``` { -Param([type]$Parameter1 [,[type]$Parameter2]) - + Param([type]$Parameter1 [,[type]$Parameter2]) + } ``` > [!NOTE] -> In a script block, unlike a function, you cannot specify parameters outside +> In a script block, unlike a function, you can't specify parameters outside > the braces. Like functions, script blocks can include the `DynamicParam`, `Begin`, -`Process`, and `End` keywords. For more information, see [about_Functions](about_Functions.md) -and [about_Functions_Advanced](about_Functions_Advanced.md). +`Process`, and `End` keywords. For more information, see [about_Functions][02] +and [about_Functions_Advanced][01]. ## Using Script Blocks @@ -92,7 +94,7 @@ 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](about_Splatting.md#splatting-with-arrays). +[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`. @@ -143,7 +145,7 @@ PS> $b 2 ``` -For more information about the call operator, see [about_Operators](about_Operators.md). +For more information about the call operator, see [about_Operators][03]. ## Using delay-bind script blocks with parameters @@ -171,7 +173,7 @@ Notes on delay-bind script blocks as parameters: - You must explicitly specify any parameter names you use with delay-bind script blocks. -- The parameter must not be untyped, and the parameter's type cannot be +- 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 pipeline input. @@ -195,6 +197,13 @@ Notes on delay-bind script blocks as parameters: ## See also -- [about_Functions](about_Functions.md) -- [about_Functions_Advanced](about_Functions_Advanced.md) -- [about_Operators](about_Operators.md) +- [about_Functions][02] +- [about_Functions_Advanced][01] +- [about_Operators][03] + + +[01]: about_Functions_Advanced.md +[02]: about_Functions.md +[03]: about_Operators.md +[04]: about_Return.md +[05]: about_Splatting.md#splatting-with-arrays diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index c77e3eccaee5..23086ddaabe1 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -1,7 +1,7 @@ --- description: Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell. Locale: en-US -ms.date: 10/26/2023 +ms.date: 11/15/2023 no-loc: [Reset, Current, Background, Blink, Bold, Foreground, Formatting, Hidden, Italic, Reset, Reverse, Underline] online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -244,8 +244,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 and script blocks (which -are unnamed functions). +The `$input` variable is available only to functions, script blocks (which +are unnamed functions), and script files (which are saved script blocks). - In a function without a `begin`, `process`, or `end` block, the `$input` variable enumerates the collection of all input to the function. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Script_Blocks.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Script_Blocks.md index 3f5c6deaf378..6614f47e9f0a 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Script_Blocks.md +++ b/reference/7.4/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/29/2022 +ms.date: 11/15/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Script Blocks @@ -15,9 +15,11 @@ the PowerShell programming language. ## Long description -In the PowerShell programming language, a script block is a -collection of statements or expressions that can be used as a single unit. -A script block can accept arguments and return values. +In the PowerShell programming language, a script block 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. You can also pass a script block to a A script block can accept +arguments and return values. Syntactically, a script block is a statement list in braces, as shown in the following syntax: @@ -30,27 +32,27 @@ A script block returns the output of all the commands in the script block, either as a single object or as an array. You can also specify a return value using the `return` keyword. The `return` -keyword does not affect or suppress other output returned from your script +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](about_Return.md). +more information, see [about_Return][04]. Like functions, a script block can include parameters. Use the Param keyword to assign named parameters, as shown in the following syntax: ``` { -Param([type]$Parameter1 [,[type]$Parameter2]) - + Param([type]$Parameter1 [,[type]$Parameter2]) + } ``` > [!NOTE] -> In a script block, unlike a function, you cannot specify parameters outside +> In a script block, unlike a function, you can't specify parameters outside > the braces. Like functions, script blocks can include the `DynamicParam`, `Begin`, -`Process`, and `End` keywords. For more information, see [about_Functions](about_Functions.md) -and [about_Functions_Advanced](about_Functions_Advanced.md). +`Process`, and `End` keywords. For more information, see [about_Functions][02] +and [about_Functions_Advanced][01]. ## Using Script Blocks @@ -92,7 +94,7 @@ 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](about_Splatting.md#splatting-with-arrays). +[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`. @@ -143,7 +145,7 @@ PS> $b 2 ``` -For more information about the call operator, see [about_Operators](about_Operators.md). +For more information about the call operator, see [about_Operators][03]. ## Using delay-bind script blocks with parameters @@ -171,7 +173,7 @@ Notes on delay-bind script blocks as parameters: - You must explicitly specify any parameter names you use with delay-bind script blocks. -- The parameter must not be untyped, and the parameter's type cannot be +- 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 pipeline input. @@ -195,6 +197,13 @@ Notes on delay-bind script blocks as parameters: ## See also -- [about_Functions](about_Functions.md) -- [about_Functions_Advanced](about_Functions_Advanced.md) -- [about_Operators](about_Operators.md) +- [about_Functions][02] +- [about_Functions_Advanced][01] +- [about_Operators][03] + + +[01]: about_Functions_Advanced.md +[02]: about_Functions.md +[03]: about_Operators.md +[04]: about_Return.md +[05]: about_Splatting.md#splatting-with-arrays