From 24ff6d6157650ce878c275cc8fb183bf22db9e58 Mon Sep 17 00:00:00 2001 From: "Mike F. Robbins" Date: Wed, 22 Jan 2025 19:15:59 -0600 Subject: [PATCH 1/6] Refresh chapter 9 of ps101 (#11720) Co-authored-by: Mike F. Robbins --- .../learn/ps101/09-functions.md | 376 +++++++++--------- 1 file changed, 194 insertions(+), 182 deletions(-) diff --git a/reference/docs-conceptual/learn/ps101/09-functions.md b/reference/docs-conceptual/learn/ps101/09-functions.md index 415e62da6903..a69bf186c358 100644 --- a/reference/docs-conceptual/learn/ps101/09-functions.md +++ b/reference/docs-conceptual/learn/ps101/09-functions.md @@ -1,40 +1,41 @@ --- -description: PowerShell functions allow you to create tools that can be reused in scripts. +description: Learn how to create reusable PowerShell functions, implement best practices, and avoid common pitfalls in function design, error handling, and parameter validation. ms.custom: Contributor-mikefrobbins -ms.date: 01/09/2025 +ms.date: 01/22/2025 ms.reviewer: mirobb title: Functions --- + # Chapter 9 - Functions -If you're writing PowerShell one-liners or scripts and find yourself often having to modify them for -different scenarios, there's a good chance that it's a good candidate to be turned into a function -that can be reused. +PowerShell one-liners and scripts that have to be modified often are good candidates to turn into +reusable functions. -Whenever possible, I prefer to write functions because they are more tool oriented. I can put the -functions in a script module, put that module in the `$env:PSModulePath`, and call the functions -without needing to physically locate where they're saved. Using the PowerShellGet module, it's easy -to share those modules in a NuGet repository. PowerShellGet ships with PowerShell version 5.0 and -higher. It is available as a separate download for PowerShell version 3.0 and higher. +Write functions whenever possible because they're more tool-oriented. You can add the functions to a +script module, put that module in a location defined in the `$env:PSModulePath`, and call the +functions without needing to locate where you saved the functions. Using the **PowerShellGet** +module, it's easy to share your PowerShell modules in a NuGet repository. **PowerShellGet** ships +with PowerShell version 5.0 and higher. It's also available as a separate download for PowerShell +version 3.0 and higher. -Don't over complicate things. Keep it simple and use the most straight forward way to accomplish a +Don't overcomplicate things. Keep it simple and use the most straightforward way to accomplish a task. Avoid aliases and positional parameters in any code that you reuse. Format your code for readability. Don't hardcode values; use parameters and variables. Don't write unnecessary code even -if it doesn't hurt anything. It adds unnecessary complexity. Attention to detail goes a long -way when writing any PowerShell code. +if it doesn't hurt anything. It adds unnecessary complexity. Attention to detail goes a long way +when writing any PowerShell code. ## Naming -When naming your functions in PowerShell, use a [Pascal case][Pascal case] name with an approved verb and a -singular noun. I also recommend prefixing the noun. For example: -`-`. - -In PowerShell, there's a specific list of approved verbs that can be obtained by running `Get-Verb`. +When naming your functions in PowerShell, use a [Pascal case][Pascal case] name with an approved +verb and a singular noun. To obtain a list of approved verbs in PowerShell, run `Get-Verb`. The +following example sorts the results of `Get-Verb` by the **Verb** property. ```powershell Get-Verb | Sort-Object -Property Verb ``` +The **Group** property gives you an idea of how the verbs are meant to be used. + ```Output Verb Group ---- ----- @@ -138,17 +139,16 @@ Watch Common Write Communications ``` -In the previous example, I've sorted the results by the **Verb** column. The **Group** column gives -you an idea of how these verbs are used. It's important to choose an approved verb in PowerShell -when functions are added to a module. The module generates a warning message at load time if you -choose an unapproved verb. That warning message makes your functions look unprofessional. Unapproved -verbs also limit the discoverability of your functions. +It's important to use an approved verb for your PowerShell functions. Modules that contain functions +with unapproved verbs generate a warning message when they're imported into a PowerShell session. +That warning message makes your functions look unprofessional. Unapproved verbs also limit the +discoverability of your functions. ## A simple function A function in PowerShell is declared with the function keyword followed by the function name and -then an open and closing curly brace. The code that the function will execute is contained within -those curly braces. +then an opening and closing curly brace (`{ }`). The code executed by the function is contained +within those curly braces. ```powershell function Get-Version { @@ -156,7 +156,8 @@ function Get-Version { } ``` -The function shown is a simple example that returns the version of PowerShell. +The function shown in the following example is a simple example that returns the version of +PowerShell. ```powershell Get-Version @@ -168,10 +169,12 @@ Major Minor Build Revision 5 1 14393 693 ``` -There's a good chance of name conflict with functions named something like `Get-Version` and default -commands in PowerShell or commands that others may write. This is why I recommend prefixing the noun -portion of your functions to help prevent naming conflicts. In the following example, I'll use the -prefix "PS". +When you use a generic name for your functions, such as `Get-Version`, it could cause naming +conflicts. Default commands added in the future or commands that others might write could conflict +with them. Prefix the noun portion of your function names to help prevent naming conflicts. For +example: `-`. + +The following example uses the prefix `PS`. ```powershell function Get-PSVersion { @@ -191,8 +194,8 @@ Major Minor Build Revision 5 1 14393 693 ``` -Even when prefixing the noun with something like PS, there's still a good chance of having a name -conflict. I typically prefix my function nouns with my initials. Develop a standard and stick to it. +You can still have a name conflict even when you add a prefix to the noun. I like to prefix my +function nouns with my initials. Develop a standard and stick to it. ```powershell function Get-MrPSVersion { @@ -200,7 +203,7 @@ function Get-MrPSVersion { } ``` -This function is no different than the previous two other than using a more sensible name to try to +This function is no different than the previous two, except for using a more unique name to try to prevent naming conflicts with other PowerShell commands. ```powershell @@ -220,15 +223,15 @@ Get-ChildItem -Path Function:\Get-*Version ``` ```Output -CommandType Name Version Source ------------ ---- ------- ------ +CommandType Name Version +----------- ---- ------- Function Get-Version Function Get-PSVersion Function Get-MrPSVersion ``` -If you want to remove these functions from your current session, you'll have to remove them from the -**Function** PSDrive or close and reopen PowerShell. +If you want to remove these functions from your current session, remove them from the **Function** +PSDrive or close and reopen PowerShell. ```powershell Get-ChildItem -Path Function:\Get-*Version | Remove-Item @@ -240,19 +243,23 @@ Verify that the functions were indeed removed. Get-ChildItem -Path Function:\Get-*Version ``` -If the functions were loaded as part of a module, the module can be unloaded to remove them. +If the functions were loaded as part of a module, you can unload the module to remove them. ```powershell Remove-Module -Name ``` -The `Remove-Module` cmdlet removes modules from memory in your current PowerShell session, it -doesn't remove them from your system or from disk. +The `Remove-Module` cmdlet removes PowerShell modules from memory in your current PowerShell +session. It doesn't remove them from your system or disk. ## Parameters -Don't statically assign values! Use parameters and variables. When it comes to naming your -parameters, use the same name as the default cmdlets for your parameter names whenever possible. +Don't statically assign values. Use parameters and variables instead. When naming your parameters, +use the same name as the default cmdlets for your parameter names whenever possible. + +In the following function, notice that I used **ComputerName** and not **Computer**, **ServerName**, +or **Host** for the parameter name. Using **ComputerName** standardizes the parameter name to match +the parameter name and case like the default cmdlets. ```powershell function Test-MrParameter { @@ -266,11 +273,8 @@ function Test-MrParameter { } ``` -Why did I use **ComputerName** and not **Computer**, **ServerName**, or **Host** for my parameter -name? It's because I wanted my function standardized like the default cmdlets. - -I'll create a function to query all of the commands on a system and return the number of them that -have specific parameter names. +The following function queries all commands on your system and returns the number with specific +parameter names. ```powershell function Get-MrParameterCount { @@ -282,19 +286,19 @@ function Get-MrParameterCount { $Results = Get-Command -ParameterName $Parameter -ErrorAction SilentlyContinue [pscustomobject]@{ - ParameterName = $Parameter + ParameterName = $Parameter NumberOfCmdlets = $Results.Count } } } ``` -As you can see in the results shown below, 39 commands that have a **ComputerName** parameter. There -aren't any cmdlets that have parameters such as **Computer**, **ServerName**, **Host**, or -**Machine**. +As you can see in the following results, 39 commands that have a **ComputerName** parameter. There +aren't any commands with parameters such as **Computer**, **ServerName**, **Host**, or **Machine**. ```powershell -Get-MrParameterCount -ParameterName ComputerName, Computer, ServerName, Host, Machine +Get-MrParameterCount -ParameterName ComputerName, Computer, ServerName, + Host, Machine ``` ```Output @@ -307,21 +311,21 @@ Host 0 Machine 0 ``` -I also recommend using the same case for your parameter names as the default cmdlets. Use -`ComputerName`, not `computername`. This makes your functions look and feel like the default -cmdlets. People who are already familiar with PowerShell will feel right at home. +Use the same case for your parameter names as the default cmdlets. For example, use `ComputerName`, +not `computername`. This naming scheme helps people familiar with PowerShell discover your functions +and look and feel like the default cmdlets. -The `param` statement allows you to define one or more parameters. The parameter definitions are -separated by a comma (`,`). For more information, see [about_Functions_Advanced_Parameters][about_Functions_Advanced_Parameters]. +The `param` statement allows you to define one or more parameters. A comma (`,`) separates the +parameter definitions. For more information, see +[about_Functions_Advanced_Parameters][about_Functions_Advanced_Parameters]. -## Advanced Functions +## Advanced functions -Turning a function in PowerShell into an advanced function is really simple. One of the differences -between a function and an advanced function is that advanced functions have a number of common -parameters that are added to the function automatically. These common parameters include parameters -such as **Verbose** and **Debug**. +Turning a function into an advanced function in PowerShell is simple. One of the differences between +a function and an advanced function is that advanced functions have common parameters that are +automatically added. Common parameters include parameters such as **Verbose** and **Debug**. -I'll start out with the `Test-MrParameter` function that was used in the previous section. +Start with the `Test-MrParameter` function that was used in the previous section. ```powershell function Test-MrParameter { @@ -335,19 +339,20 @@ function Test-MrParameter { } ``` -What I want you to notice is that the `Test-MrParameter` function doesn't have any common -parameters. There are a couple of different ways to see the common parameters. One is by viewing the -syntax using `Get-Command`. +There are a couple of different ways to see the common parameters. One is by viewing the syntax with +`Get-Command`. ```powershell Get-Command -Name Test-MrParameter -Syntax ``` +Notice the `Test-MrParameter` function doesn't have any common parameters. + ```Output Test-MrParameter [[-ComputerName] ] ``` -Another is to drill down into the parameters with `Get-Command`. +Another is to drill down into the parameters property of `Get-Command`. ```powershell (Get-Command -Name Test-MrParameter).Parameters.Keys @@ -357,12 +362,12 @@ Another is to drill down into the parameters with `Get-Command`. ComputerName ``` -Add `CmdletBinding` to turn the function into an advanced function. +Add the `CmdletBinding` attribute to turn the function into an advanced function. ```powershell function Test-MrCmdletBinding { - [CmdletBinding()] #<<-- This turns a regular function into an advanced function + [CmdletBinding()] # Turns a regular function into an advanced function param ( $ComputerName ) @@ -372,8 +377,8 @@ function Test-MrCmdletBinding { } ``` -Adding `CmdletBinding` adds the common parameters automatically. `CmdletBinding` requires a `param` -block, but the `param` block can be empty. +When you specify `CmdletBinding`, the common parameters are added automatically. `CmdletBinding` +requires a `param` block, but the `param` block can be empty. ```powershell Get-Command -Name Test-MrCmdletBinding -Syntax @@ -383,8 +388,8 @@ Get-Command -Name Test-MrCmdletBinding -Syntax Test-MrCmdletBinding [[-ComputerName] ] [] ``` -Drilling down into the parameters with `Get-Command` shows the actual parameter names including the -common ones. +Drilling down into the parameters property of `Get-Command` shows the actual parameter names, +including the common ones. ```powershell (Get-Command -Name Test-MrCmdletBinding).Parameters.Keys @@ -407,8 +412,8 @@ PipelineVariable ## SupportsShouldProcess -`SupportsShouldProcess` adds **WhatIf** and **Confirm** parameters. These are only needed for -commands that make changes. +The `SupportsShouldProcess` attribute adds the **WhatIf** and **Confirm** risk mitigation +parameters. These parameters are only needed for commands that make changes. ```powershell function Test-MrSupportsShouldProcess { @@ -430,11 +435,12 @@ Get-Command -Name Test-MrSupportsShouldProcess -Syntax ``` ```Output -Test-MrSupportsShouldProcess [[-ComputerName] ] [-WhatIf] [-Confirm] [] +Test-MrSupportsShouldProcess [[-ComputerName] ] [-WhatIf] [-Confirm] +[] ``` -Once again, you can also use `Get-Command` to return a list of the actual parameter names including -the common ones along with WhatIf and Confirm. +Once again, you can also use `Get-Command` to return a list of the actual parameter names, including +the common, ones along with **WhatIf** and **Confirm**. ```powershell (Get-Command -Name Test-MrSupportsShouldProcess).Parameters.Keys @@ -457,12 +463,14 @@ WhatIf Confirm ``` -## Parameter Validation +## Parameter validation -Validate input early on. Why allow your code to continue on a path when it's not possible to -run without valid input? +Validate input early on. Don't allow your code to continue on a path when it can't complete without +valid input. -Always type the variables that are being used for your parameters (specify a datatype). +Always specify a datatype for the variables used for parameters. In the following example, +**String** is specified as the datatype for the **ComputerName** parameter. This validation limits +it to only allow a single computer name to be specified for the **ComputerName** parameter. ```powershell function Test-MrParameterValidation { @@ -477,28 +485,31 @@ function Test-MrParameterValidation { } ``` -In the previous example, I've specified **String** as the datatype for the **ComputerName** -parameter. This causes it to allow only a single computer name to be specified. If more than one -computer name is specified via a comma-separated list, an error is generated. +An error is generated if more than one computer name is specified. ```powershell Test-MrParameterValidation -ComputerName Server01, Server02 ``` ```Output -Test-MrParameterValidation : Cannot process argument transformation on parameter -'ComputerName'. Cannot convert value to type System.String. +Test-MrParameterValidation : Cannot process argument transformation on +parameter 'ComputerName'. Cannot convert value to type System.String. At line:1 char:42 + Test-MrParameterValidation -ComputerName Server01, Server02 -+ - + CategoryInfo : InvalidData: (:) [Test-MrParameterValidation], ParameterBindingArg - umentTransformationException - + FullyQualifiedErrorId : ParameterArgumentTransformationError,Test-MrParameterValidation ++ ~~~~~~~~~~~~~~~~~~ + + CategoryInfo : InvalidData: (:) [Test-MrParameterValidation] + , ParameterBindingArgumentTransformationException + + FullyQualifiedErrorId : ParameterArgumentTransformationError,Test-MrP + arameterValidation ``` The problem with the current definition is that it's valid to omit the value of the **ComputerName** -parameter, but a value is required for the function to complete successfully. This is where the -`Mandatory` parameter attribute comes in handy. +parameter, but a value is required for the function to complete successfully. This scenario is where +the `Mandatory` parameter attribute is beneficial. + +The syntax used in the following example is compatible with PowerShell version 3.0 and higher. +`[Parameter(Mandatory=$true)]` could be specified to make the function compatible with PowerShell +version 2.0 or higher. ```powershell function Test-MrParameterValidation { @@ -514,10 +525,7 @@ function Test-MrParameterValidation { } ``` -The syntax used in the previous example is PowerShell version 3.0 and higher compatible. -`[Parameter(Mandatory=$true)]` could be specified instead to make the function compatible with -PowerShell version 2.0 and higher. Now that the **ComputerName** is required, if one isn't -specified, the function will prompt for one. +Now that the **ComputerName** is required, if one isn't specified, the function prompts for one. ```powershell Test-MrParameterValidation @@ -529,8 +537,8 @@ Supply values for the following parameters: ComputerName: ``` -If you want to allow for more than one value for the **ComputerName** parameter, use the **String** -datatype but add open and closed square brackets to the datatype to allow for an array of strings. +If you want to allow more than one value for the **ComputerName** parameter, use the **String** +datatype but add square brackets (`[]`) to the datatype to allow an array of strings. ```powershell function Test-MrParameterValidation { @@ -547,8 +555,12 @@ function Test-MrParameterValidation { ``` Maybe you want to specify a default value for the **ComputerName** parameter if one isn't specified. -The problem is that default values can't be used with mandatory parameters. Instead, you'll need to -use the `ValidateNotNullOrEmpty` parameter validation attribute with a default value. +The problem is that default values can't be used with mandatory parameters. Instead, use the +`ValidateNotNullOrEmpty` parameter validation attribute with a default value. + +Even when setting a default value, try not to use static values. In the following example, +`$env:COMPUTERNAME` is used as the default value, which is automatically translated to the local +computer name if a value isn't provided. ```powershell function Test-MrParameterValidation { @@ -564,18 +576,14 @@ function Test-MrParameterValidation { } ``` -Even when setting a default value, try not to use static values. In the previous example, -`$env:COMPUTERNAME` is used as the default value, which is automatically translated into the local -computer name if a value is not provided. - -## Verbose Output +## Verbose output -While comments are useful, especially if you're writing some complex code, they never get seen by -users unless they look into the code itself. +Inline commands are useful if you're writing complex code, but users don't see them unless they look +at the code. -The function shown in the following example has a in the `foreach` loop. While this particular -comment may not be that difficult to locate, imagine if the function included hundreds of lines of -code. +The function in the following example has an inline comment in the `foreach` loop. While this +particular comment might not be difficult to locate, imagine if the function contained hundreds of +lines of code. ```powershell function Test-MrVerboseOutput { @@ -587,15 +595,15 @@ function Test-MrVerboseOutput { ) foreach ($Computer in $ComputerName) { - # Attempting to perform some action on $Computer + #Attempting to perform an action on $Computer <<-- Don't use + #inline comments like this, use write verbose instead. Write-Output $Computer } } ``` -Rather than using comments like this, a better option is to use `Write-Verbose` so that the -information can be seen by the user if they want it. +A better option is to use `Write-Verbose` instead of inline comments. ```powershell function Test-MrVerboseOutput { @@ -607,43 +615,43 @@ function Test-MrVerboseOutput { ) foreach ($Computer in $ComputerName) { - Write-Verbose -Message "Attempting to perform some action on $Computer" + Write-Verbose -Message "Attempting to perform an action on $Computer" Write-Output $Computer } } ``` -When you call the function without the **Verbose** parameter, the verbose output isn't displayed. +The verbose output isn't displayed when the function is called without the **Verbose** parameter. ```powershell Test-MrVerboseOutput -ComputerName Server01, Server02 ``` -When it's called with the **Verbose** parameter, the function displays the verbose output. +The verbose output is displayed when the function is called with the **Verbose** parameter. ```powershell Test-MrVerboseOutput -ComputerName Server01, Server02 -Verbose ``` -## Pipeline Input +## Pipeline input -When you want your function to accept pipeline input, some additional coding is necessary. As -mentioned earlier in this book, commands can accept pipeline input **by value** (by type) or **by -property name**. You can write your functions just like the native commands so that they accept -either one or both of these types of input. +Extra code is necessary when you want your function to accept pipeline input. As mentioned earlier +in this book, commands can accept pipeline input **by value** (by type) or **by property name**. You +can write your functions like the native commands so they accept either one or both of these input +types. -To accept pipeline input **by value**, specified the `ValueFromPipeline` parameter attribute for -that particular parameter. Keep in mind that you can only accept pipeline input **by value** from -one of each datatype. For example, if you have two parameters that accept string input, only one of -those can accept pipeline input **by value** because if you specified it for both of the string -parameters, the pipeline input wouldn't know which one to bind to. This is another reason I call -this type of pipeline input _by type_ instead of **by value**. +To accept pipeline input **by value**, specify the `ValueFromPipeline` parameter attribute for that +particular parameter. You can only accept pipeline input **by value** from one parameter of each +datatype. If you have two parameters that accept string input, only one of them can accept pipeline +input **by value**. If you specified **by value** for both of the string parameters, the input +wouldn't know which parameter to bind to. This scenario is another reason I call this type of +pipeline input _by type_ instead of **by value**. -Pipeline input comes in one item at a time similar to the way items are handled in a `foreach` loop. -At a minimum, a `process` block is required to process each of these items if you're accepting an -array as input. If you're only accepting a single value as input, a `process` block isn't necessary, -but I still recommend specifying it for consistency. +Pipeline input is received one item at a time, similar to how items are handled in a `foreach` loop. +A `process` block is required to process each item if your function accepts an array as input. If +your function only accepts a single value as input, a `process` block isn't necessary but is +recommended for consistency. ```powershell function Test-MrPipelineInput { @@ -655,18 +663,17 @@ function Test-MrPipelineInput { [string[]]$ComputerName ) - PROCESS { + process { Write-Output $ComputerName } } ``` -Accepting pipeline input **by property name** is similar except it's specified with the -`ValueFromPipelineByPropertyName` parameter attribute and it can be specified for any number of -parameters regardless of datatype. The key is that the output of the command that's being piped in -has to have a property name that matches the name of the parameter or a parameter alias of your -function. +Accepting pipeline input **by property name** is similar, except you specify it with the +`ValueFromPipelineByPropertyName` parameter attribute, and it can be specified for any number of +parameters regardless of datatype. The key is the output of the command being piped in must have a +property name that matches the name of the parameter or a parameter alias of your function. ```powershell function Test-MrPipelineInput { @@ -678,20 +685,19 @@ function Test-MrPipelineInput { [string[]]$ComputerName ) - PROCESS { + process { Write-Output $ComputerName } } ``` -`BEGIN` and `END` blocks are optional. `BEGIN` would be specified before the `PROCESS` block and is -used to perform any initial work prior to the items being received from the pipeline. This is -important to understand. Values that are piped in are not accessible in the `BEGIN` block. The `END` -block would be specified after the `PROCESS` block and is used for cleanup once all of the items -that are piped in have been processed. +`begin` and `end` blocks are optional. `begin` is specified before the `process` block and is used +to perform any initial work before the items are received from the pipeline. Values that are piped +in aren't accessible in the `begin` block. The `end` block is specified after the `process` block +and is used for cleanup after all items piped in are processed. -## Error Handling +## Error handling The function shown in the following example generates an unhandled exception when a computer can't be contacted. @@ -707,7 +713,7 @@ function Test-MrErrorHandling { [string[]]$ComputerName ) - PROCESS { + process { foreach ($Computer in $ComputerName) { Test-WSMan -ComputerName $Computer } @@ -730,7 +736,7 @@ function Test-MrErrorHandling { [string[]]$ComputerName ) - PROCESS { + process { foreach ($Computer in $ComputerName) { try { Test-WSMan -ComputerName $Computer @@ -744,10 +750,10 @@ function Test-MrErrorHandling { } ``` -Although the function shown in the previous example uses error handling, it also generates an -unhandled exception because the command doesn't generate a terminating error. This is also important -to understand. Only terminating errors are caught. Specify the **ErrorAction** parameter with -**Stop** as the value to turn a non-terminating error into a terminating one. +Although the function shown in the previous example uses error handling, it generates an unhandled +exception because the command doesn't generate a terminating error. Only terminating errors are +caught. Specify the **ErrorAction** parameter with **Stop** as its value to turn a nonterminating +error into a terminating one. ```powershell function Test-MrErrorHandling { @@ -760,7 +766,7 @@ function Test-MrErrorHandling { [string[]]$ComputerName ) - PROCESS { + process { foreach ($Computer in $ComputerName) { try { Test-WSMan -ComputerName $Computer -ErrorAction Stop @@ -774,16 +780,17 @@ function Test-MrErrorHandling { } ``` -Don't modify the global `$ErrorActionPreference` variable unless absolutely necessary. If you're -using something like .NET directly from within your PowerShell function, you can't specify the -**ErrorAction** on the command itself. In that scenario, you might need to change the global -`$ErrorActionPreference` variable, but if you do change it, change it back immediately after trying -the command. +Don't modify the global `$ErrorActionPreference` variable unless absolutely necessary. If you change +it in a local scope, it reverts to the previous value when you exit that scope. -## Comment-Based Help +If you're using something like .NET directly from within your PowerShell function, you can't specify +the **ErrorAction** parameter on the command itself. You can change the `$ErrorActionPreference` +variable just before you call the .NET method. -It's considered to be a best practice to add comment based help to your functions so the people -you're sharing them with will know how to use them. +## Comment-based help + +Adding help to your functions is considered a best practice. Help allows people you share them with +to know how to use them. ```powershell function Get-MrAutoStoppedService { @@ -794,17 +801,17 @@ function Get-MrAutoStoppedService { currently running, excluding the services that are set to delayed start. .DESCRIPTION - Get-MrAutoStoppedService is a function that returns a list of services from - the specified remote computer(s) that are set to start automatically, are not - currently running, and it excludes the services that are set to start automatically - with a delayed startup. + Get-MrAutoStoppedService is a function that returns a list of services + from the specified remote computer(s) that are set to start + automatically, are not currently running, and it excludes the services + that are set to start automatically with a delayed startup. .PARAMETER ComputerName The remote computer(s) to check the status of the services on. .PARAMETER Credential - Specifies a user account that has permission to perform this action. The default - is the current user. + Specifies a user account that has permission to perform this action. The + default is the current user. .EXAMPLE Get-MrAutoStoppedService -ComputerName 'Server1', 'Server2' @@ -822,8 +829,8 @@ function Get-MrAutoStoppedService { PSCustomObject .NOTES - Author: Mike F Robbins - Website: http://mikefrobbins.com + Author: Mike F. Robbins + Website: https://mikefrobbins.com Twitter: @mikefrobbins #> @@ -837,31 +844,35 @@ function Get-MrAutoStoppedService { } ``` -When you add comment based help to your functions, help can be retrieved for them just like the -default built-in commands. +When you add comment-based help to your functions, help can be retrieved for them like the default +built-in commands. -All of the syntax for writing a function in PowerShell can seem overwhelming especially for someone -who is just getting started. Often times if I can't remember the syntax for something, I'll open a -second copy of the ISE on a separate monitor and view the "Cmdlet (advanced function) - Complete" -snippet while typing in the code for my function. Snippets can be accessed in the PowerShell ISE -using the Ctrl+J key combination. +All the syntax for writing a function in PowerShell can seem overwhelming for someone getting +started. If you can't remember the syntax for something, open a second instance of the PowerShell +Integrated Scripting Environment (ISE) on a separate monitor and view the "Cmdlet (advanced +function) - Complete" snippet while typing in the code for your functions. Snippets can be accessed +in the PowerShell ISE using the Ctrl + J key combination. ## Summary -In this chapter you've learned the basics of writing functions in PowerShell to include how to turn -a function into an advanced function and some of the more important elements that you should -consider when writing PowerShell functions such as parameter validation, verbose output, pipeline -input, error handling, and comment based help. +In this chapter, you learned the basics of writing functions in PowerShell, including how to: + +- Create advanced functions +- Use parameter validation +- Use verbose output +- Support pipeline input +- Handle errors +- Create comment-based help ## Review 1. How do you obtain a list of approved verbs in PowerShell? 1. How do you turn a PowerShell function into an advanced function? 1. When should **WhatIf** and **Confirm** parameters be added to your PowerShell functions? -1. How do you turn a non-terminating error into a terminating one? -1. Why should you add comment based help to your functions? +1. How do you turn a nonterminating error into a terminating one? +1. Why should you add comment-based help to your functions? -## Recommended Reading +## References - [about_Functions][about_Functions] - [about_Functions_Advanced_Parameters][about_Functions_Advanced_Parameters] @@ -873,6 +884,7 @@ input, error handling, and comment based help. - [Video: PowerShell Toolmaking with Advanced Functions and Script Modules][Video: PowerShell Toolmaking with Advanced Functions and Script Modules] + [about_Functions]: /powershell/module/microsoft.powershell.core/about/about_functions [about_Functions_Advanced_Parameters]: /powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters [about_CommonParameters]: /powershell/module/microsoft.powershell.core/about/about_commonparameters From f6083ba0fea74dbf5aa4bb385f0a55b5a15a6a37 Mon Sep 17 00:00:00 2001 From: Arie Heinrich Date: Thu, 23 Jan 2025 02:18:40 +0100 Subject: [PATCH 2/6] Markdown and PS Styles (#11721) --- .../About/about_Job_Details.md | 31 ++++++++++--------- .../About/about_Join.md | 4 +-- .../About/about_Language_Keywords.md | 4 +-- .../About/about_Language_Modes.md | 2 +- .../About/about_Logging_Non-Windows.md | 10 +++--- .../About/about_Logging_Windows.md | 3 +- .../About/about_Member-Access_Enumeration.md | 6 ++-- .../About/about_Methods.md | 4 +-- .../About/about_Module_Manifests.md | 4 +-- .../About/about_Modules.md | 3 +- .../About/about_Object_Creation.md | 2 +- .../About/about_Objects.md | 2 +- .../About/about_Operator_Precedence.md | 6 ++-- .../About/about_Operators.md | 26 ++++++++-------- .../About/about_PSConsoleHostReadLine.md | 1 + .../About/about_PSCustomObject.md | 2 +- .../About/about_PSItem.md | 10 +++--- .../About/about_PackageManagement.md | 9 ++++-- .../About/about_Parameter_Binding.md | 4 +-- .../About/about_Parameter_Sets.md | 4 +-- .../About/about_Parameters.md | 8 ++--- .../About/about_Parameters_Default_Values.md | 2 +- .../About/about_Parsing.md | 3 +- .../About/about_Pipelines.md | 12 +++---- .../About/about_PowerShell_Editions.md | 2 +- 25 files changed, 83 insertions(+), 81 deletions(-) diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md index cd0d17d69f7d..8708ba18e8f9 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md @@ -145,14 +145,15 @@ start the job. - When you use `Start-Job` to start a job on a local computer, the job consists of an executive parent job and a child job that runs the command. -- When you use the **AsJob** parameter of `Invoke-Command` to start a job on one or - more computers, the job consists of an executive parent job and a child job - for each job run on each computer. +- When you use the **AsJob** parameter of `Invoke-Command` to start a job on + one or more computers, the job consists of an executive parent job and a + child job for each job run on each computer. -- When you use `Invoke-Command` to run a `Start-Job` command on one or more remote - computers, the result is the same as a local command run on each remote - computer. The command returns a job object for each computer. The job object - consists of an executive parent job and one child job that runs the command. +- When you use `Invoke-Command` to run a `Start-Job` command on one or more + remote computers, the result is the same as a local command run on each + remote computer. The command returns a job object for each computer. The job + object consists of an executive parent job and one child job that runs the + command. The parent job represents all of the child jobs. When you manage a parent job, you also manage the associated child jobs. For example, if you stop a parent @@ -239,10 +240,10 @@ exist only in a particular session. Workflow jobs can be suspended and resumed. The cmdlets that you use to manage custom jobs depend on the job type. For -some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. Others -come with specialized cmdlets that manage only a particular type of job. For -detailed information about custom job types, see the help topics about the job -type. +some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. +Others come with specialized cmdlets that manage only a particular type of job. +For detailed information about custom job types, see the help topics about the +job type. To find the job type of a job, use the `Get-Job` cmdlet. `Get-Job` returns different job objects for different types of jobs. The value of the @@ -265,9 +266,9 @@ The following table lists the job types that come with PowerShell. | PSEventJob | Created using`Register-ObjectEvent` and specifying an | | | action with the **Action** parameter. | -NOTE: Before using the `Get-Job` cmdlet to get jobs of a particular type, verify -that the module that adds the job type is imported into the current session. -Otherwise, `Get-Job` does not get jobs of that type. +NOTE: Before using the `Get-Job` cmdlet to get jobs of a particular type, +verify that the module that adds the job type is imported into the current +session. Otherwise, `Get-Job` does not get jobs of that type. ## Examples @@ -354,7 +355,7 @@ Id Name JobTriggers Command Enabled - [about_Jobs](about_Jobs.md) - [about_Remote](about_Remote.md) - [about_Remote_Jobs](about_Remote_Jobs.md) -- [about_Thread_Jobs](/powershell/module/microsoft.powershell.core/about/about_Thread_Jobs) +- [about_Thread_Jobs](about_Thread_Jobs) - [Invoke-Command](xref:Microsoft.PowerShell.Core.Invoke-Command) - [Get-Job](xref:Microsoft.PowerShell.Core.Get-Job) - [Remove-Job](xref:Microsoft.PowerShell.Core.Remove-Job) diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md index 77454371d428..336b867ee933 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md @@ -24,8 +24,8 @@ in the command. The following diagram shows the syntax for the join operator. ```powershell --Join - -Join +-join + -join ``` #### Parameters diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md index 715a81113986..c4397eb68650 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md @@ -184,8 +184,8 @@ do {} until () ## `dynamicparam` -Specifies one part of the body of a function, along with the `begin`, `process`, -and `end` keywords. Dynamic parameters are added at runtime. +Specifies one part of the body of a function, along with the `begin`, +`process`, and `end` keywords. Dynamic parameters are added at runtime. Syntax: diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Modes.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Modes.md index e4bf24a58c59..4c70df3446f5 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Modes.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Modes.md @@ -339,7 +339,7 @@ Beginning in PowerShell 7.2, the `New-Object` cmdlet is disabled in [01]: /powershell/scripting/learn/remoting/jea/session-configurations -[02]: about_member-access_enumeration.md +[02]: about_Member-Access_Enumeration.md [03]: about_Session_Configuration_Files.md [04]: about_Session_Configurations.md [05]: xref:Microsoft.PowerShell.Core.New-PSSessionConfigurationFile diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md index d9a5684334c9..b88bd71c1ab6 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md @@ -295,11 +295,11 @@ To view PowerShell log data from a command line on macOS, use the `log` command in the **Terminal** or other shell host application. These commands can be run from **PowerShell**, **Z Shell**, or **Bash**. -In the following example, the `log` command is used to show the log data on your -system as it's occurring in realtime. The **process** parameter filters the log -data for only the `pwsh` process. If you have more than one instance of `pwsh` -running, the **process** parameter also accepts a process ID as its value. The -**level** parameter shows messages at the specified level and below. +In the following example, the `log` command is used to show the log data on +your system as it's occurring in realtime. The **process** parameter filters +the log data for only the `pwsh` process. If you have more than one instance of +`pwsh` running, the **process** parameter also accepts a process ID as its +value. The **level** parameter shows messages at the specified level and below. ```powershell log stream --predicate "subsystem == 'com.microsoft.powershell'" --level info diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Windows.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Windows.md index 5a67d5f67ead..6a4bb4e98fee 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Windows.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Logging_Windows.md @@ -203,8 +203,7 @@ private key: ```powershell Get-WinEvent Microsoft-Windows-PowerShell/Operational | - Where-Object Id -eq 4104 | - Unprotect-CmsMessage + Where-Object Id -eq 4104 | Unprotect-CmsMessage ``` ## See also diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md index 189aeda791e7..4e7ed434af41 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md @@ -57,8 +57,8 @@ During member-access enumeration for a property, the operator returns the value of the property for each item that has that property. If no items have the specified property, the operator returns `$null`. -During member-access enumeration for a method, the operator attempts to call the -method on each item in the collection. If any item in the collection does +During member-access enumeration for a method, the operator attempts to call +the method on each item in the collection. If any item in the collection does not have the specified method, the operator returns the **MethodNotFound** exception. @@ -333,7 +333,7 @@ in the array. ### Collections containing PSCustomObject instances If the collection of objects contains instances of **PSCustomObject** items, -PowerShell unexpectedly retruns `$null` values when the accessed property is +PowerShell unexpectedly returns `$null` values when the accessed property is missing. In the following examples at least one object has the referenced property. diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Methods.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Methods.md index f53d3cba4d32..4aa0ab5b9adb 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Methods.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Methods.md @@ -115,8 +115,8 @@ two method signatures: ``` The first method signature takes the destination file name (and a path). The -following example uses the first `CopyTo` method to copy the `Final.txt` file to -the `C:\Bin` directory. +following example uses the first `CopyTo` method to copy the `Final.txt` file +to the `C:\Bin` directory. ```powershell (Get-ChildItem c:\final.txt).CopyTo("c:\bin\final.txt") diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Module_Manifests.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Module_Manifests.md index 5390034d8824..07fc3ae5c284 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Module_Manifests.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Module_Manifests.md @@ -1559,10 +1559,10 @@ imported as `Get-ExampleItem`. [03]: /powershell/gallery/concepts/package-manifest-affecting-ui [04]: /powershell/scripting/dev-cross-plat/performance/module-authoring-considerations [05]: /powershell/scripting/developer/module/supporting-updatable-help -[06]: about_experimental_features.md#declaring-experimental-features-in-modules-written-in-powershell +[06]: about_Experimental_Features.md#declaring-experimental-features-in-modules-written-in-powershell [07]: about_Format.ps1xml.md [08]: about_Language_Modes.md -[09]: about_powershell_editions.md +[09]: about_Powershell_Editions.md [10]: about_Types.ps1xml.md [11]: about_Updatable_Help.md [13]: xref:Microsoft.PowerShell.Core.New-ModuleManifest diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Modules.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Modules.md index 2a093373842c..6499f8f384a6 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Modules.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Modules.md @@ -248,8 +248,7 @@ For example, to find the commands in the **BitsTransfer** module, type: Get-Command -Module BitsTransfer ``` -For more information about the `Get-Command` cmdlet, see -[Get-Command][11]. +For more information about the `Get-Command` cmdlet, see [Get-Command][11]. ## Remove a module diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Object_Creation.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Object_Creation.md index 6127f2413016..2b201da9b14f 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Object_Creation.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Object_Creation.md @@ -289,7 +289,7 @@ New-PSSession -ComputerName Server01 -SessionOption @{ IdleTimeout=43200000 SkipCnCheck=$True } -Register-ScheduledJob Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ +Register-ScheduledJob -Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ Frequency="Daily" At="15:00" } diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md index 3e03286822e0..a5617df59b3c 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md @@ -38,7 +38,7 @@ in commands to take action and manage data. You can discover an objects properties and methods using [Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member) or the `psobject` - [intrinsic member](about_Intrinsic_Members.md). +[intrinsic member](about_Intrinsic_Members.md). ## Objects in Pipelines diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md index 4f300182f0b4..68013811edca 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md @@ -121,8 +121,8 @@ $read_only = ( Get-ChildItem *.txt | Where-Object {$_.isReadOnly} ) Because the pipeline operator (`|`) has a higher precedence than the assignment operator (`=`), the files that the `Get-ChildItem` cmdlet gets are sent to the -`Where-Object` cmdlet for filtering before they are assigned to the `$read_only` -variable. +`Where-Object` cmdlet for filtering before they are assigned to the +`$read_only` variable. The following example demonstrates that the index operator takes precedence over the cast operator. @@ -194,7 +194,7 @@ are reading and maintaining your scripts. [assign]: about_Assignment_Operators.md [compare]: about_Comparison_Operators.md [join]: about_Join.md -[logic]: about_logical_operators.md +[logic]: about_Logical_Operators.md [ops]: about_Operators.md [redir]: about_Redirection.md [scopes]: about_Scopes.md diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md index 8995fa382fb6..64b44a6496e7 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md @@ -251,7 +251,7 @@ For more information, see [about_Parsing][08]. This example stores a command in a string and executes it using the call operator. -``` +```powershell PS> $c = "Get-ExecutionPolicy" PS> $c Get-ExecutionPolicy @@ -262,7 +262,7 @@ AllSigned The call operator doesn't parse strings. This means that you can't use command parameters within a string when you use the call operator. -``` +```powershell PS> $c = "Get-Service -Name Spooler" PS> $c Get-Service -Name Spooler @@ -276,7 +276,7 @@ try again. The [Invoke-Expression][25] cmdlet can execute code that causes parsing errors when using the call operator. -``` +```powershell PS> & "1+1" &: The term '1+1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was @@ -293,7 +293,7 @@ the contents of the quoted string instead of running the script. The call operator allows you to execute the contents of the string containing the filename. -``` +```powershell PS C:\Scripts> Get-ChildItem Directory: C:\Scripts @@ -465,7 +465,7 @@ objects to be formatted on the right side of the operator. "{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi ``` -```output +```Output 1 hello 3.14 ``` @@ -477,7 +477,7 @@ formatted string to. "{0:00} {1:000} {2:000000}" -f 7, 24, 365 ``` -```output +```Output 07 024 000365 ``` @@ -502,7 +502,7 @@ value. Given a list of indices, the index operator returns a list of members corresponding to those indices. -``` +```powershell PS> $a = 1, 2, 3 PS> $a[0] 1 @@ -523,7 +523,7 @@ $h = @{key="value"; name="PowerShell"; version="2.0"} $h["name"] ``` -```output +```Output PowerShell ``` @@ -532,7 +532,7 @@ $x = [xml]"Once upon a time..." $x["doc"] ``` -```output +```Output intro ----- Once upon a time... @@ -542,7 +542,7 @@ When an object isn't an indexed collection, using the index operator to access the first element returns the object itself. Index values beyond the first element return `$null`. -``` +```powershell PS> (2)[0] 2 PS> (2)[-1] @@ -707,7 +707,7 @@ expression. ```powershell $myProcess.peakWorkingSet -(Get-Process PowerShell).kill() +(Get-Process PowerShell).Kill() 'OS', 'Platform' | Foreach-Object { $PSVersionTable. $_ } ``` @@ -872,9 +872,9 @@ ${a}?[0] [10]: about_If.md [11]: about_Jobs.md [12]: about_Join.md -[13]: about_logical_operators.md +[13]: about_Logical_Operators.md [14]: about_Member-Access_Enumeration.md -[15]: about_operator_precedence.md +[15]: about_Operator_Precedence.md [16]: About_Pipeline_Chain_Operators.md [17]: about_Preference_Variables.md#ofs [18]: about_Redirection.md diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index 6343d212f1e2..404720b7a63a 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -9,6 +9,7 @@ title: about_PSConsoleHostReadLine # about_PSConsoleHostReadLine ## Short description + Explains how to customize how PowerShell reads input at the console prompt. ## Long description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md index 4dfd2b86445c..4d7d5483fe25 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md @@ -296,6 +296,6 @@ properties. [01]: about_Object_Creation.md [02]: about_Objects.md -[03]: about_type_accelerators.md +[03]: about_Type_Accelerators.md [04]: xref:System.Management.Automation.PSCustomObject [05]: xref:System.Management.Automation.PSObject diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSItem.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSItem.md index 805dcd21f2f8..27280fbf1de5 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSItem.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSItem.md @@ -41,9 +41,9 @@ cases. ## ForEach-Object Process -The [ForEach-Object][02] cmdlet is designed to operate -on objects in the pipeline, executing the **Process** parameter's scriptblock -once for every object in the pipeline. +The [ForEach-Object][02] cmdlet is designed to operate on objects in the +pipeline, executing the **Process** parameter's scriptblock once for every +object in the pipeline. You can use `$PSItem` in the **Process** parameter's scriptblock but not in the **Begin** or **End** parameter scriptblocks. If you reference `$PSItem` in the @@ -374,9 +374,9 @@ with the default format for the current culture by casting the value to ## See also - [about_Arrays][04] -- [about_automatic_variables][01] +- [about_Automatic_Variables][01] - [about_Comparison_Operators][12] -- [about_functions][08] +- [about_Functions][08] - [about_Script_Blocks][14] - [about_Switch][07] - [ForEach-Object][02] diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PackageManagement.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PackageManagement.md index d05f763fbbc8..3ec9884b38a5 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PackageManagement.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PackageManagement.md @@ -42,8 +42,7 @@ us define some terms: stored in a specific package source. The PackageManagement module includes the following cmdlets. For more -information, see the [PackageManagement](/powershell/module/packagemanagement) -help. +information, see the [PackageManagement][01] help. - `Get-PackageProvider`: Returns a list of package providers that are connected to PackageManagement. @@ -101,7 +100,7 @@ More Information About the PackageManagement Project For more information about the PackageManagement open development project, including how to create a PackageManagement package provider, see the -PackageManagement project on GitHub at https://oneget.org. +PackageManagement project on GitHub at [https://oneget.org][02]. ## See also @@ -115,3 +114,7 @@ PackageManagement project on GitHub at https://oneget.org. - [Register-PackageSource](xref:PackageManagement.Register-PackageSource) - [Set-PackageSource](xref:PackageManagement.Set-PackageSource) - [Unregister-PackageSource](xref:PackageManagement.Unregister-PackageSource) + + +[01]: /powershell/module/packagemanagement +[02]: https://oneget.org diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md index 2bf47a2194dd..1d54b776d2c7 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md @@ -93,6 +93,6 @@ example, see the [Visualize parameter binding][01] article. [01]: /powershell/scripting/learn/deep-dives/visualize-parameter-binding -[02]: about_functions_advanced_parameters.md#valuefrompipeline-argument -[03]: about_functions_advanced_parameters.md#valuefrompipelinebypropertyname-argument +[02]: about_Functions_Advanced_Parameters.md#valuefrompipeline-argument +[03]: about_Functions_Advanced_Parameters.md#valuefrompipelinebypropertyname-argument [04]: xref:Microsoft.PowerShell.Utility.Trace-Command diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md index b1993dc37afa..9ad31a9e70c8 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md @@ -163,7 +163,7 @@ which parameters can be used in each parameter set. ```powershell (Get-Command Measure-Lines).ParameterSets | - Select-Object -Property @{n='ParameterSetName';e={$_.name}}, + Select-Object -Property @{n='ParameterSetName';e={$_.Name}}, @{n='Parameters';e={$_.ToString()}} ``` @@ -272,4 +272,4 @@ $Var4 = 3 ``` -[01]: about_functions_cmdletbindingattribute.md +[01]: about_Functions_CmdletBindingAttribute.md diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters.md index e76daedb0b7a..c3a54c5b92e0 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters.md @@ -31,8 +31,8 @@ a value, but do not require the parameter name in the command. The type of parameters and the requirements for those parameters vary. To find information about the parameters of a command, use the `Get-Help` cmdlet. For -example, to find information about the parameters of the `Get-ChildItem` cmdlet, -type: +example, to find information about the parameters of the `Get-ChildItem` +cmdlet, type: ```powershell Get-Help Get-ChildItem @@ -179,8 +179,8 @@ Get-Service -Name $s #### Accepts Pipeline Input -This setting indicates whether you can use the pipeline operator (`|`) to send a -value to the parameter. +This setting indicates whether you can use the pipeline operator (`|`) to send +a value to the parameter. ``` Value Description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index 30eca6439b23..7677b4aa60d6 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -118,7 +118,7 @@ using an array. This example sets the default value of the ```powershell $PSDefaultParameterValues = @{ - 'Invoke-Command:ComputerName' = 'Server01','Server02' + 'Invoke-Command:ComputerName' = 'Server01', 'Server02' } ``` diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parsing.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parsing.md index 7515afbe1cec..8245ba780e19 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parsing.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parsing.md @@ -412,8 +412,7 @@ TestExe -echoargs --% """%ProgramFiles(x86)%\Microsoft\\"" > [ProcessStartInfo.ArgumentList][01]. PowerShell 7.3 also added the ability to trace parameter binding for native -commands. For more information, see -[Trace-Command][08]. +commands. For more information, see [Trace-Command][08]. ## Passing arguments to PowerShell commands diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md index 0ff6abf63a28..18586d200d94 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -272,8 +272,8 @@ pipeline to display a table of service objects. Get-Service | Format-Table -Property Name, DependentServices ``` -Functionally, this is like using the **InputObject** parameter of `Format-Table` -to submit the object collection. +Functionally, this is like using the **InputObject** parameter of +`Format-Table` to submit the object collection. For example, we can save the collection of services to a variable that's passed using the **InputObject** parameter. @@ -631,9 +631,9 @@ Get-Process | Where-Object CPU | Where-Object Path [02]: #investigating-pipeline-errors -[03]: about_command_syntax.md -[04]: about_foreach.md -[05]: about_objects.md -[06]: about_parameters.md +[03]: about_Command_Syntax.md +[04]: about_Foreach.md +[05]: about_Objects.md +[06]: about_Parameters.md [07]: about_Redirection.md [08]: xref:System.Data.DataTable.Rows diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index 855543cfcd98..a9002e4bfa78 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -111,7 +111,7 @@ 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' +New-ModuleManifest -Path .\TestModuleWithEdition.psd1 -CompatiblePSEditions Desktop, Core -PowerShellVersion '5.1' $ModuleInfo = Test-ModuleManifest -Path .\TestModuleWithEdition.psd1 $ModuleInfo.CompatiblePSEditions ``` From 583312a421e746475bb0a6051bdf098c402118c2 Mon Sep 17 00:00:00 2001 From: Arie Heinrich Date: Thu, 23 Jan 2025 20:23:31 +0100 Subject: [PATCH 3/6] fix reference (#11722) --- .../7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md index 8708ba18e8f9..3d11ec2fccaa 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md @@ -355,7 +355,7 @@ Id Name JobTriggers Command Enabled - [about_Jobs](about_Jobs.md) - [about_Remote](about_Remote.md) - [about_Remote_Jobs](about_Remote_Jobs.md) -- [about_Thread_Jobs](about_Thread_Jobs) +- [about_Thread_Jobs](about_Thread_Jobs.md) - [Invoke-Command](xref:Microsoft.PowerShell.Core.Invoke-Command) - [Get-Job](xref:Microsoft.PowerShell.Core.Get-Job) - [Remove-Job](xref:Microsoft.PowerShell.Core.Remove-Job) From 0c643864f68ed6ea4e0a6a5d2a1c6d107b8f4b28 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Thu, 23 Jan 2025 14:33:51 -0600 Subject: [PATCH 4/6] Sync formatting changes across all versions (#11724) --- .../About/about_Alias_Provider.md | 67 ++++++++++-------- .../About/about_Aliases.md | 4 +- .../About/about_Arithmetic_Operators.md | 27 ++++---- .../About/about_Arrays.md | 6 +- .../About/about_Assignment_Operators.md | 60 ++++++++++------ .../About/about_Automatic_Variables.md | 15 ++-- .../About/about_Break.md | 8 ++- .../About/about_Case-Sensitivity.md | 34 ++++++---- .../About/about_Character_Encoding.md | 40 ++++++----- .../About/about_CimSession.md | 20 ++++-- .../About/about_Classes_Constructors.md | 4 +- .../About/about_Classes_Inheritance.md | 8 +-- .../About/about_Classes_Methods.md | 2 +- .../About/about_Classes_Properties.md | 2 +- .../About/about_Comment_Based_Help.md | 2 +- .../About/about_CommonParameters.md | 2 +- .../About/about_Comparison_Operators.md | 8 +-- .../About/about_Continue.md | 12 ++-- .../About/about_Data_Files.md | 9 +-- .../About/about_Data_Sections.md | 10 +-- .../About/about_Debuggers.md | 44 ++++++------ .../About/about_Environment_Provider.md | 61 ++++++++++------- .../About/about_Environment_Variables.md | 6 +- .../About/about_Execution_Policies.md | 3 +- .../About/about_FileSystem_Provider.md | 2 +- .../About/about_For.md | 16 +++-- .../About/about_Foreach.md | 7 +- .../About/about_Format.ps1xml.md | 25 +++++-- .../About/about_Function_Provider.md | 55 +++++++++------ .../About/about_Functions.md | 14 ++-- .../About/about_Functions_Advanced.md | 7 +- .../About/about_Functions_Advanced_Methods.md | 2 +- .../about_Functions_Advanced_Parameters.md | 2 +- .../about_Functions_Argument_Completion.md | 6 +- .../About/about_Hash_Tables.md | 48 +++++++------ .../About/about_Hidden.md | 22 +++--- .../About/about_History.md | 30 +++++--- .../About/about_Job_Details.md | 30 ++++---- .../About/about_Join.md | 4 +- .../About/about_Language_Modes.md | 3 +- .../About/about_Member-Access_Enumeration.md | 6 +- .../About/about_Methods.md | 5 +- .../About/about_Module_Manifests.md | 38 ++++++----- .../About/about_Modules.md | 4 +- .../About/about_Object_Creation.md | 2 +- .../About/about_Objects.md | 8 +-- .../About/about_Operator_Precedence.md | 7 +- .../About/about_Operators.md | 30 ++++---- .../About/about_PSConsoleHostReadLine.md | 1 + .../About/about_PSCustomObject.md | 3 +- .../About/about_PSItem.md | 10 +-- .../About/about_PackageManagement.md | 10 ++- .../About/about_Parameter_Binding.md | 4 +- .../About/about_Parameter_Sets.md | 9 +-- .../About/about_Parameters.md | 9 +-- .../About/about_Parameters_Default_Values.md | 2 +- .../About/about_Parsing.md | 16 ++--- .../About/about_Pipelines.md | 12 ++-- .../About/about_ANSI_Terminals.md | 7 +- .../About/about_Alias_Provider.md | 67 ++++++++++-------- .../About/about_Aliases.md | 4 +- .../About/about_Arithmetic_Operators.md | 27 ++++---- .../About/about_Arrays.md | 8 +-- .../About/about_Assignment_Operators.md | 7 +- .../About/about_Automatic_Variables.md | 15 ++-- .../About/about_Booleans.md | 1 + .../About/about_Break.md | 7 +- .../About/about_Built-in_Functions.md | 4 +- .../About/about_Calling_Generic_Methods.md | 16 +++-- .../About/about_Case-Sensitivity.md | 34 ++++++---- .../About/about_Character_Encoding.md | 40 ++++++----- .../About/about_CimSession.md | 14 ++-- .../About/about_Classes.md | 1 + .../About/about_Classes_Inheritance.md | 8 +-- .../About/about_Classes_Methods.md | 2 +- .../About/about_Classes_Properties.md | 2 +- .../About/about_Command_Syntax.md | 3 +- .../About/about_Comment_Based_Help.md | 2 +- .../About/about_CommonParameters.md | 6 +- .../About/about_Comparison_Operators.md | 8 +-- .../About/about_Continue.md | 12 ++-- .../About/about_Core_Commands.md | 1 + .../About/about_Data_Files.md | 9 +-- .../About/about_Data_Sections.md | 10 +-- .../About/about_Debuggers.md | 44 ++++++------ .../About/about_Do.md | 1 + .../About/about_Environment_Provider.md | 52 ++++++++------ .../About/about_Environment_Variables.md | 9 +-- .../About/about_Execution_Policies.md | 37 +++++----- .../About/about_Experimental_Features.md | 4 +- .../About/about_FileSystem_Provider.md | 9 +-- .../About/about_For.md | 16 +++-- .../About/about_Foreach.md | 7 +- .../About/about_Format.ps1xml.md | 68 ++++++++++--------- .../About/about_Function_Provider.md | 56 +++++++++------ .../About/about_Functions.md | 16 ++--- .../About/about_Functions_Advanced.md | 3 +- .../About/about_Functions_Advanced_Methods.md | 2 +- .../about_Functions_Advanced_Parameters.md | 4 +- .../about_Functions_Argument_Completion.md | 6 +- .../About/about_Group_Policy_Settings.md | 3 +- .../About/about_Hash_Tables.md | 48 +++++++------ .../About/about_Hidden.md | 22 +++--- .../About/about_History.md | 30 +++++--- .../About/about_Job_Details.md | 32 +++++---- .../About/about_Join.md | 5 +- .../About/about_Language_Keywords.md | 5 +- .../About/about_Language_Modes.md | 3 +- .../About/about_Logging_Non-Windows.md | 12 ++-- .../About/about_Logging_Windows.md | 6 +- .../About/about_Member-Access_Enumeration.md | 6 +- .../About/about_Methods.md | 5 +- .../About/about_Module_Manifests.md | 5 +- .../About/about_Modules.md | 4 +- .../About/about_Object_Creation.md | 2 +- .../About/about_Objects.md | 3 +- .../About/about_Operator_Precedence.md | 7 +- .../About/about_Operators.md | 31 +++++---- .../About/about_PSConsoleHostReadLine.md | 1 + .../About/about_PSCustomObject.md | 3 +- .../About/about_PSItem.md | 10 +-- .../About/about_PackageManagement.md | 10 ++- .../About/about_Parameter_Binding.md | 4 +- .../About/about_Parameter_Sets.md | 9 +-- .../About/about_Parameters.md | 9 +-- .../About/about_Parameters_Default_Values.md | 2 +- .../About/about_Parsing.md | 9 ++- .../About/about_Pipelines.md | 12 ++-- .../About/about_PowerShell_Editions.md | 8 ++- .../About/about_ANSI_Terminals.md | 2 +- .../About/about_Arrays.md | 3 +- .../About/about_Assignment_Operators.md | 2 +- .../About/about_Automatic_Variables.md | 1 + .../About/about_Calling_Generic_Methods.md | 1 + .../About/about_Case-Sensitivity.md | 2 +- .../About/about_Classes_Constructors.md | 3 +- .../About/about_Classes_Inheritance.md | 1 + .../About/about_Classes_Methods.md | 1 + .../About/about_Classes_Properties.md | 1 + .../About/about_Comment_Based_Help.md | 2 +- .../About/about_Functions.md | 2 +- .../about_Functions_Argument_Completion.md | 2 +- .../About/about_Job_Details.md | 7 +- .../About/about_Join.md | 1 + .../About/about_Language_Keywords.md | 2 +- .../About/about_Objects.md | 1 + .../About/about_Operator_Precedence.md | 1 - .../About/about_PSCustomObject.md | 2 +- .../About/about_PowerShell_Editions.md | 7 +- .../About/about_ANSI_Terminals.md | 4 +- .../About/about_Alias_Provider.md | 67 ++++++++++-------- .../About/about_Aliases.md | 4 +- .../About/about_Arithmetic_Operators.md | 24 +++---- .../About/about_Arrays.md | 8 +-- .../About/about_Assignment_Operators.md | 5 +- .../About/about_Automatic_Variables.md | 15 ++-- .../About/about_Break.md | 7 +- .../About/about_Built-in_Functions.md | 4 +- .../About/about_Calling_Generic_Methods.md | 16 +++-- .../About/about_Case-Sensitivity.md | 33 +++++---- .../About/about_Character_Encoding.md | 39 ++++++----- .../About/about_CimSession.md | 13 ++-- .../About/about_Classes_Inheritance.md | 8 +-- .../About/about_Classes_Methods.md | 2 +- .../About/about_Classes_Properties.md | 2 +- .../About/about_Comment_Based_Help.md | 2 +- .../About/about_CommonParameters.md | 6 +- .../About/about_Comparison_Operators.md | 8 +-- .../About/about_Continue.md | 12 ++-- .../About/about_Data_Files.md | 8 +-- .../About/about_Data_Sections.md | 10 +-- .../About/about_Debuggers.md | 44 ++++++------ .../About/about_Environment_Provider.md | 51 ++++++++------ .../About/about_Environment_Variables.md | 8 +-- .../About/about_Execution_Policies.md | 37 +++++----- .../About/about_Experimental_Features.md | 4 +- .../About/about_FileSystem_Provider.md | 9 +-- .../About/about_For.md | 15 ++-- .../About/about_Foreach.md | 6 +- .../About/about_Format.ps1xml.md | 68 ++++++++++--------- .../About/about_Function_Provider.md | 51 ++++++++------ .../About/about_Functions.md | 18 ++--- .../About/about_Functions_Advanced.md | 3 +- .../About/about_Functions_Advanced_Methods.md | 2 +- .../about_Functions_Advanced_Parameters.md | 4 +- .../about_Functions_Argument_Completion.md | 5 +- .../About/about_Group_Policy_Settings.md | 3 +- .../About/about_Hash_Tables.md | 48 +++++++------ .../About/about_Hidden.md | 21 +++--- .../About/about_History.md | 29 +++++--- .../About/about_Job_Details.md | 32 +++++---- .../About/about_Join.md | 4 +- .../About/about_Language_Keywords.md | 6 +- .../About/about_Language_Modes.md | 2 +- .../About/about_Logging_Non-Windows.md | 10 +-- .../About/about_Logging_Windows.md | 3 +- .../About/about_Member-Access_Enumeration.md | 6 +- .../About/about_Methods.md | 4 +- .../About/about_Module_Manifests.md | 4 +- .../About/about_Modules.md | 3 +- .../About/about_Object_Creation.md | 2 +- .../About/about_Objects.md | 2 +- .../About/about_Operator_Precedence.md | 6 +- .../About/about_Operators.md | 26 +++---- .../About/about_PSConsoleHostReadLine.md | 1 + .../About/about_PSCustomObject.md | 4 +- .../About/about_PSItem.md | 10 +-- .../About/about_PackageManagement.md | 9 ++- .../About/about_Parameter_Binding.md | 4 +- .../About/about_Parameter_Sets.md | 4 +- .../About/about_Parameters.md | 8 +-- .../About/about_Parameters_Default_Values.md | 2 +- .../About/about_Parsing.md | 3 +- .../About/about_Pipelines.md | 12 ++-- .../About/about_PowerShell_Editions.md | 7 +- 215 files changed, 1578 insertions(+), 1221 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md index ec5cbc8c28c7..86d20bd307af 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md @@ -40,28 +40,27 @@ The aliases have no child items. The **Alias** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] PowerShell includes a set of cmdlets that are designed to view and to change aliases. When you use **Alias** cmdlets, you do not need to specify the `Alias:` drive in the name. This article does not cover working with **Alias** cmdlets. -- [Export-Alias](xref:Microsoft.PowerShell.Utility.Export-Alias) -- [Get-Alias](xref:Microsoft.PowerShell.Utility.Get-Alias) -- [Import-Alias](xref:Microsoft.PowerShell.Utility.Import-Alias) -- [New-Alias](xref:Microsoft.PowerShell.Utility.New-Alias) -- [Set-Alias](xref:Microsoft.PowerShell.Utility.Set-Alias) +- [Export-Alias][07] +- [Get-Alias][08] +- [Import-Alias][09] +- [New-Alias][10] +- [Set-Alias][11] ## Types exposed by this provider -Each alias is an instance of the -[System.Management.Automation.AliasInfo](/dotnet/api/system.management.automation.aliasinfo) +Each alias is an instance of the [System.Management.Automation.AliasInfo][12] class. ## Navigating the Alias drive @@ -87,11 +86,8 @@ path. > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), `cd` is -> an alias for -> [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` -> is an alias for -> [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][13], `cd` is an alias for [Set-Location][02], and `pwd` is an +> alias for [Get-Location][01]. ### Displaying the Contents of the Alias: drive @@ -198,7 +194,7 @@ cmdlet. The `-Options` parameter is available in `Set-Item` when you use it with the **Alias** or **Function** provider. ```powershell -Set-Item -Path Alias:dir -Options "AllScope,ReadOnly" +Set-Item -Path Alias:dir -Options "AllScope, ReadOnly" ``` ### Change an aliases referenced command @@ -293,8 +289,8 @@ Determines the value of the **Options** property of an alias. #### Cmdlets supported -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item) +- [New-Item][04] +- [Set-Item][14] ## Using the pipeline @@ -309,10 +305,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system -drive or use the `-Path` parameter of -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system -drive. +[Get-Help][15] command in a file system drive or use the `-Path` parameter of +[Get-Help][15] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -324,5 +318,24 @@ Get-Help Get-ChildItem -Path alias: ## See also -- [about_Aliases](about_Aliases.md) -- [about_Providers](about_Providers.md) +- [about_Aliases][16] +- [about_Providers][17] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: xref:Microsoft.PowerShell.Utility.Export-Alias +[08]: xref:Microsoft.PowerShell.Utility.Get-Alias +[09]: xref:Microsoft.PowerShell.Utility.Import-Alias +[10]: xref:Microsoft.PowerShell.Utility.New-Alias +[11]: xref:Microsoft.PowerShell.Utility.Set-Alias +[12]: /dotnet/api/system.management.automation.aliasinfo +[13]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[14]: xref:Microsoft.PowerShell.Management.Set-Item +[15]: xref:Microsoft.PowerShell.Core.Get-Help +[16]: about_Aliases.md +[17]: about_Providers.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Aliases.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Aliases.md index 3ed505a7ed7b..d66ed1c4db53 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Aliases.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Aliases.md @@ -127,8 +127,8 @@ in the current session, type: Get-Alias ``` -To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. For -example, to get aliases that begin with "p", type: +To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. +For example, to get aliases that begin with "p", type: ```powershell Get-Alias -Name p* diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md index e855e9d4f366..76d64b67bb82 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md @@ -9,6 +9,7 @@ title: about_Arithmetic_Operators # about_Arithmetic_Operators ## Short description + Describes the operators that perform arithmetic in PowerShell. ## Long description @@ -202,7 +203,7 @@ result without losing precision. For example: (2 + 3.1).GetType().FullName ``` -```output +```Output 5.1 System.Int32 System.Double @@ -216,7 +217,7 @@ is widened to accommodate the result, as in the following example: (512MB * 512MB).GetType().FullName ``` -```output +```Output System.Int32 System.Double ``` @@ -226,10 +227,10 @@ following example, the negative value can't be cast to an unsigned integer, and the unsigned integer is too large to be cast to `Int32`: ```powershell -([int32]::minvalue + [uint32]::maxvalue).gettype().fullname +([int32]::minvalue + [uint32]::maxvalue).GetType().FullName ``` -```output +```Output System.Int64 ``` @@ -268,8 +269,8 @@ PS> [ulong](9223372036854775807 + 2) 9223372036854775808 ``` -Defining the larger value as `[ulong]` first avoids the problem and produces the -correct result. +Defining the larger value as `[ulong]` first avoids the problem and produces +the correct result. ```powershell PS> 9223372036854775807ul + 2 @@ -326,7 +327,7 @@ $b = "A","B","C" $a + $b ``` -```output +```Output 1 2 3 @@ -389,7 +390,7 @@ $hash2 = @{c1="Server01"; c2="Server02"} $hash1 + $hash2 ``` -```output +```Output Name Value ---- ----- c2 Server02 @@ -408,7 +409,7 @@ $hash2 = @{c1="Server01"; c="Server02"} $hash1 + $hash2 ``` -```output +```Output OperationStopped: Line | 3 | $hash1 + $hash2 @@ -426,7 +427,7 @@ $array2 = $array1 + $hash1 $array2 ``` -```output +```Output 0 Hello World @@ -447,7 +448,7 @@ However, you can't add any other type to a hash table. $hash1 + 2 ``` -```output +```Output InvalidOperation: A hash table can only be added to another hash table. ``` @@ -462,7 +463,7 @@ $array = @() $array ``` -```output +```Output 0 1 2 @@ -507,7 +508,7 @@ results are then added using the `+` operator. Get-Process | Where-Object { ($_.ws * 2) -gt 50mb } ``` -```output +```Output Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 1896 39 50968 30620 264 1,572.55 1104 explorer diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md index 6f67cef704f0..851033378976 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -68,7 +68,7 @@ values of a particular type, cast the variable as an array type, such as variable name with an array type enclosed in brackets. For example: ```powershell -[int32[]]$ia = 1500, 2230, 3350, 4000 +[Int32[]]$ia = 1500, 2230, 3350, 4000 ``` As a result, the `$ia` array can contain only integers. @@ -639,8 +639,8 @@ The value of `mode` must be a [WhereOperatorSelectionMode][02] enum value: - `Default` (`0`) - Return all items - `First` (`1`) - Return the first item - `Last` (`2`) - Return the last item -- `SkipUntil` (`3`) - Skip items until condition is true, return all the remaining - items (including the first item for which the condition is true) +- `SkipUntil` (`3`) - Skip items until condition is true, return all the + remaining items (including the first item for which the condition is true) - `Until` (`4`) - Return all items until condition is true - `Split` (`5`) - Return an array of two elements - The first element contains matching items diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md index 069451d34624..51451fd59a07 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md @@ -9,6 +9,7 @@ title: about_Assignment_Operators # about_Assignment_Operators ## Short description + Describes how to use operators to assign values to variables. ## Long description @@ -50,10 +51,10 @@ $MyShell = "PowerShell" ``` When you assign a value to a variable in PowerShell, the variable is created if -it didn't already exist. For example, the first of the following two -assignment statements creates the `$a` variable and assigns a value of 6 to -`$a`. The second assignment statement assigns a value of 12 to `$a`. The first -statement creates a new variable. The second statement changes only its value: +it didn't already exist. For example, the first of the following two assignment +statements creates the `$a` variable and assigns a value of 6 to `$a`. The +second assignment statement assigns a value of 12 to `$a`. The first statement +creates a new variable. The second statement changes only its value: ```powershell $a = 6 @@ -142,20 +143,35 @@ Compound assignment operators perform numeric operations on the values before the assignment. > [!IMPORTANT] -> Compound assignment operators do not use dynamic scoping. The variable is -> always in the current scope. In the following example, the variable `$x` is -> defined in the global scope. The braces create a new scope. The variable `$x` -> inside the braces is a new instance and not a reference to the global -> variable. -> -> ```powershell -> $x = 1 # Global scope -> & { $x += 1; $x } -> ``` -> -> ```Output -> 1 -> ``` +> Compound assignment operators don't use dynamic scoping. The variable is +> always in the current scope. + +In the following example, the variable `$x` is defined in the global scope. The +braces create a new scope. The variable `$x` inside the braces is a new +instance and not a copy of the global variable. + +```powershell +$x = 1 # Global scope +& { $x += 1; $x } +``` + +```Output +1 +``` + +When you use the regular assignment operator, you get a copy of the variable +from the parent scope. But notice that `$x` in the parent scope is not changed. + +```powershell +$x = 1 # Global scope +& { $x = $x + 1; $x } +"Global `$x = $x" +``` + +```Output +2 +Global $x = 1 +``` ### The assignment by addition operator @@ -183,7 +199,7 @@ $a += 2 $a ``` -``` +```Output 6 ``` @@ -240,7 +256,7 @@ assignments fail. For example, the following command assigns a hash table to the `$a` variable. Then, it uses the `+=` operator to append another hash table to the existing -hash table, effectively adding a new key/value pair to the existing hash table. +hash table, effectively adding a new key-value pair to the existing hash table. This command succeeds, as shown in the output: ```powershell @@ -279,8 +295,8 @@ At line:2 char:1 The assignment by subtraction operator `-=` decrements the value of a variable by the value that's specified on the right side of the operator. This operator -can't be used with string variables, and it can't be used to remove an -element from a collection. +can't be used with string variables, and it can't be used to remove an element +from a collection. The `-=` operator combines two operations. First, it subtracts, and then it assigns. Therefore, the following statements are equivalent: 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 b7dca818e643..0773e9879cb4 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 @@ -389,7 +389,7 @@ the objects. ```powershell $a = "one", $null, "three" -$a.count +$a.Count ``` ```Output @@ -400,7 +400,7 @@ If you pipe the `$null` variable to the `ForEach-Object` cmdlet, it generates a value for `$null`, just as it does for the other objects ```powershell -"one", $null, "three" | ForEach-Object { "Hello " + $_} +"one", $null, "three" | ForEach-Object {"Hello " + $_} ``` ```Output @@ -418,8 +418,8 @@ were ignored. ```powershell $calendar = @($null, $null, "Meeting", $null, $null, "Team Lunch", $null) -$days = "Sunday","Monday","Tuesday","Wednesday","Thursday", - "Friday","Saturday" +$days = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday" $currentDay = 0 foreach($day in $calendar) { @@ -704,10 +704,9 @@ isn't considered best practice. ### MoveNext -The [MoveNext][76] method -advances the enumerator to the next element of the collection. **MoveNext** -returns `True` if the enumerator was successfully advanced, `False` if the -enumerator has passed the end of the collection. +The [MoveNext][76] method advances the enumerator to the next element of the +collection. **MoveNext** returns `True` if the enumerator was successfully +advanced, `False` if the enumerator has passed the end of the collection. > [!NOTE] > The **Boolean** value returned by **MoveNext** is sent to the output stream. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md index 712d3cd39816..9785a090b3f1 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Break.md @@ -9,6 +9,7 @@ title: about_Break # about_Break ## Short description + Describes the `break` statement, which provides a way to exit the current control block. @@ -122,7 +123,8 @@ even pass control across script and function call boundaries. ## Using `break` in a `switch` statement -In a `switch`construct, `break` causes PowerShell to exit the `switch` code block. +In a `switch`construct, `break` causes PowerShell to exit the `switch` code +block. The `break` keyword is used to leave the `switch` construct. For example, the following `switch` statement uses `break` statements to test for the most @@ -189,8 +191,8 @@ function test { test ``` -Notice that execution stops at the exception. The `After loop` is never reached. -The exception is re-thrown after the `trap` executes. +Notice that execution stops at the exception. The `After loop` is never +reached. The exception is re-thrown after the `trap` executes. ```Output Before loop diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md index 23027f5fe17e..fce34a74baeb 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md @@ -9,39 +9,43 @@ title: about_Case-Sensitivity # about_Case-Sensitivity ## Short description + PowerShell is as case-insensitive as possible while preserving case. ## Long description -As a general principle, PowerShell is as case insensitive as possible while preserving case and not -breaking the underlying OS. +As a general principle, PowerShell is as case insensitive as possible while +preserving case and not breaking the underlying OS. ### On Unix-based systems -On Unix-based systems, PowerShell is case-sensitive because filesystem manipulation and environment -variables directly affect the underlying operating system and integration with other tools. +On Unix-based systems, PowerShell is case-sensitive because filesystem +manipulation and environment variables directly affect the underlying +operating system and integration with other tools. ## On all systems - PowerShell variables are case-insensitive - Variable names have no interaction between them and the underlying operating system. PowerShell - treats them case-insensitively. + Variable names have no interaction between them and the underlying operating + system. PowerShell treats them case-insensitively. - Module names are case-insensitive (with exceptions) - The _name_ of the module is purely a PowerShell concept and treated case-insensitively. However, there - is a strong mapping to a foldername, which can be case-sensitive in the underlying operating - system. Importing two modules with the same case-insensitive name has the same behavior as + The _name_ of the module is purely a PowerShell concept and treated + case-insensitively. However, there is a strong mapping to a foldername, which + can be case-sensitive in the underlying operating system. Importing two| + modules with the same case-insensitive name has the same behavior as importing two modules with the same name from different paths. - The name of a module is stored in the session state using the case by which it was imported. The - name, as stored in the session state, is used by `Update-Help` when looking for new help files. - The web service that serves the help files for Microsoft uses a case-sensitive filesystem. When - the case of the imported name of the module doesn't match, `Update-Help` can't find the help files - and reports an error. + The name of a module is stored in the session state using the case by which + it was imported. The name, as stored in the session state, is used + `Update-Help` when looking for new help files. + The web service that serves the help files for Microsoft uses a + case-sensitive filesystem. When the case of the imported name of the module + doesn't match, `Update-Help` can't find the help files and reports an error. ## Related links -- [about_Environment_Variables](about_environment_variables.md) +- [about_Environment_Variables](about_Environment_Variables.md) - [Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Character_Encoding.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Character_Encoding.md index ba311f4a338f..cc8da665cfef 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Character_Encoding.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Character_Encoding.md @@ -9,6 +9,7 @@ title: about_Character_Encoding # about_Character_Encoding ## Short description + Describes how PowerShell uses character encoding for input and output of string data. @@ -16,8 +17,7 @@ data. Unicode is a worldwide character-encoding standard. The system uses Unicode exclusively for character and string manipulation. For a detailed description -of all aspects of Unicode, refer to -[The Unicode Standard](https://www.unicode.org/standard/standard.html). +of all aspects of Unicode, refer to [The Unicode Standard][01]. Windows supports Unicode and traditional character sets. Traditional character sets, such as Windows code pages, use 8-bit values or combinations of 8-bit @@ -49,8 +49,7 @@ The following cmdlets have the **Encoding** parameter: The byte-order-mark (BOM) is a _Unicode signature_ in the first few bytes of a file or text stream that indicate which Unicode encoding used for the data. For -more information, see the -[Byte order mark](/globalization/encoding/byte-order-mark) documentation. +more information, see the [Byte order mark][02] documentation. In Windows PowerShell, any Unicode encoding, except `UTF7`, always creates a BOM. PowerShell (v6 and higher) defaults to `utf8NoBOM` for all text output. @@ -92,9 +91,9 @@ In PowerShell 5.1, the **Encoding** parameter supports the following values: - `UTF7` Uses UTF-7. - `UTF8` Uses UTF-8 (with BOM). -In general, Windows PowerShell uses the Unicode -[UTF-16LE](https://wikipedia.org/wiki/UTF-16) encoding by default. However, -the default encoding used by cmdlets in Windows PowerShell is not consistent. +In general, Windows PowerShell uses the Unicode [UTF-16LE][03] encoding by +default. However, the default encoding used by cmdlets in Windows PowerShell +is not consistent. > [!NOTE] > Using any Unicode encoding, except `UTF7`, always creates a BOM. @@ -104,7 +103,7 @@ For cmdlets that write output to files: - `Out-File` and the redirection operators `>` and `>>` create UTF-16LE, which notably differs from `Set-Content` and `Add-Content`. -- `New-ModuleManifest` and `Export-CliXml` also create UTF-16LE files. +- `New-ModuleManifest` and `Export-Clixml` also create UTF-16LE files. - When the target file is empty or doesn't exist, `Set-Content` and `Add-Content` use `Default` encoding. `Default` is the encoding specified by @@ -117,7 +116,7 @@ For cmdlets that write output to files: - `New-Item -Type File -Value` creates a BOM-less UTF-8 file. -- `Send-MailMessage` uses `Default` encoding by default. +- `Send-MailMessage` uses `Ascii` encoding by default. - `Start-Transcript` creates `Utf8` files with a BOM. When the **Append** parameter is used, the encoding can be different (see below). @@ -149,7 +148,7 @@ For cmdlets that read string data in the absence of a BOM: encoding. ANSI is also what the PowerShell engine uses when it reads source code from files. -- `Import-Csv`, `Import-CliXml`, and `Select-String` assume `Utf8` in the +- `Import-Csv`, `Import-Clixml`, and `Select-String` assume `Utf8` in the absence of a BOM. ## Character encoding in PowerShell @@ -173,8 +172,7 @@ PowerShell defaults to `utf8NoBOM` for all output. Beginning with PowerShell 6.2, the **Encoding** parameter also allows numeric IDs of registered code pages (like `-Encoding 1251`) or string names of registered code pages (like `-Encoding "windows-1251"`). For more information, -see the .NET documentation for -[Encoding.CodePage](/dotnet/api/system.text.encoding.codepage). +see the .NET documentation for [Encoding.CodePage][04]. ## Changing the default encoding @@ -184,8 +182,7 @@ encoding behavior. - `$PSDefaultParameterValues` - `$OutputEncoding` -For more information, see -[about_Preference_Variables](about_Preference_Variables.md). +For more information, see [about_Preference_Variables][05]. Beginning in PowerShell 5.1, the redirection operators (`>` and `>>`) call the `Out-File` cmdlet. Therefore, you can set the default encoding of them using @@ -218,10 +215,17 @@ the output redirection operators and PowerShell cmdlets use to save to files. ## See also -- [about_Preference_Variables](about_Preference_Variables.md) +- [about_Preference_Variables][05] - [Byte order mark](https://wikipedia.org/wiki/Byte_order_mark) - [Code Pages - Win32 apps](/windows/win32/intl/code-pages) -- [Encoding.CodePage](/dotnet/api/system.text.encoding.codepage) +- [Encoding.CodePage][04] - [Introduction to character encoding in .NET](/dotnet/standard/base-types/character-encoding-introduction) -- [The Unicode Standard](https://www.unicode.org/standard/standard.html) -- [UTF-16LE](https://wikipedia.org/wiki/UTF-16) +- [The Unicode Standard][01] +- [UTF-16LE][03] + + +[01]: https://www.unicode.org/standard/standard.html +[02]: /globalization/encoding/byte-order-mark +[03]: https://wikipedia.org/wiki/UTF-16 +[04]: /dotnet/api/system.text.encoding.codepage +[05]: about_Preference_Variables.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_CimSession.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_CimSession.md index 218a6cc1e3d4..3d79bdb7de6a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_CimSession.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_CimSession.md @@ -9,6 +9,7 @@ title: about_CimSession # about_CimSession ## Short description + Describes a **CimSession** object and the difference between CIM sessions and PowerShell sessions. @@ -19,9 +20,9 @@ represents a connection to a local computer or a remote computer. You can use CIM sessions as an alternative to PowerShell sessions (PSSessions). Both approaches have advantages. -You can use the `New-CimSession` cmdlet to create a CIM session that contains -information about a connection, such as computer name, the protocol used for -the connection, session ID, and instance ID. +You can use the `New-CimSession` cmdlet on a Windows computer to create a CIM +session that contains information about a connection, such as computer name, +the protocol used for the connection, session ID, and instance ID. After you create a **CimSession** object that specifies information required to establish a connection, PowerShell does not establish the connection @@ -33,7 +34,7 @@ If you create a **PSSession** instead of using a CIM session, PowerShell validates connection settings, and then establishes and maintains the connection. If you use CIM sessions, PowerShell does not open a network connection until needed. For more information about PowerShell sessions, see -[about_PSSessions](about_PSSessions.md). +[about_PSSessions][01]. ## When to use a CIM session @@ -54,7 +55,7 @@ Management (WinRM). CIM sessions do not impose the WinRM limits. CIM-based Cmdlet Definition XML (CDXML) cmdlets can be written to use any WMI Provider. All WMI providers use **CimSession** objects. For more information -about CDXML, see [CDXML definition and terms](/previous-versions/windows/desktop/wmi_v2/cdxml-overview). +about CDXML, see [CDXML definition and terms][02]. CDXML cmdlets have an automatic **CimSession** parameter that can take an array of **CimSession** objects. By default, PowerShell limits number of concurrent @@ -64,5 +65,10 @@ understand the **ThrottleLimit**. ## See also -- [about_PSSessions](about_PSSessions.md) -- [New-CimSession](xref:CimCmdlets.New-CimSession) +- [about_PSSessions][01] +- [New-CimSession][03] + + +[01]: about_PSSessions.md +[02]: /previous-versions/windows/desktop/wmi_v2/cdxml-overview +[03]: xref:CimCmdlets.New-CimSession diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index 67f1c72e8ff8..623654d78319 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -484,7 +484,7 @@ text in angle brackets as needed. class { static [hashtable[]] $MemberDefinitions = @( @{ - MemberName = '' + Name = '' MemberType = '' Value = } @@ -541,7 +541,7 @@ PowerShell class constructors have the following limitations: - [about_Classes_Methods][01] - [about_Classes_Properties][09] - + [01]: about_Classes_Methods.md [02]: #static-constructors [03]: about_Classes_Properties.md#default-property-values diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md index c0b0f7fec0be..c5acd70baa0f 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md @@ -18,8 +18,8 @@ Describes how you can define classes that extend other types. PowerShell classes support _inheritance_, which allows you to define a child class that reuses (inherits), extends, or modifies the behavior of a parent class. The class whose members are inherited is called the _base class_. The -class that inherits the members of the base class is called the _derived -class_. +class that inherits the members of the base class is called the +_derived class_. PowerShell supports single inheritance only. A class can only inherit from a single class. However, inheritance is transitive, which allows you to define an @@ -1500,8 +1500,8 @@ the value of an inherited static property in a class that doesn't override the property might have unintended effects for classes derived from the same base class. -[Example 1][05] shows how -derived classes that inherit, extend, and override the base class properties. +[Example 1][05] shows how derived classes that inherit, extend, and override +the base class properties. ### Deriving from generics diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md index c07d8786728e..f1aea5402bd3 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md @@ -800,7 +800,7 @@ PowerShell class methods have the following limitations: [01]: about_Preference_Variables.md [02]: #hidden-methods [03]: #static-methods -[04]: about_functions_advanced_parameters.md#parameter-and-variable-validation-attributes +[04]: about_Functions_Advanced_Parameters.md#parameter-and-variable-validation-attributes [05]: #example-4---static-method-with-overloads [06]: #defining-instance-methods-with-update-typedata [07]: about_Automatic_Variables.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Properties.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Properties.md index 377380e94ce4..7ac91c1c2b84 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Properties.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Properties.md @@ -957,7 +957,7 @@ PowerShell class properties have the following limitations: [06]: /dotnet/csharp/language-reference/builtin-types/default-values [07]: about_Hidden.md [08]: about_Classes_Inheritance.md -[09]: about_functions_advanced_parameters.md#parameter-and-variable-validation-attributes +[09]: about_Functions_Advanced_Parameters.md#parameter-and-variable-validation-attributes [10]: about_Classes.md [11]: about_Classes_Constructors.md [12]: about_Classes_Inheritance.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md index 19a64bfc80ad..967c145301d1 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md @@ -171,7 +171,7 @@ function Get-Function { } The following are valid comment-based help keywords. These keywords can appear in any order in the comment-based help, and they aren't case-sensitive. The -keywords are listed in in this article inthe order that they typically appear +keywords are listed in this article in the order that they typically appear in a help topic. ### .SYNOPSIS diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md index 7d157ff844e9..65c5a4abfd5b 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md @@ -773,7 +773,7 @@ Mode LastWriteTime Length Name [02]: about_Automatic_Variables.md [03]: about_Preference_Variables.md -[05]: about_functions_advanced.md +[05]: about_Functions_Advanced.md [06]: xref:Microsoft.PowerShell.Utility.Write-Progress [07]: xref:System.Management.Automation.ActionPreference [11]: xref:Microsoft.PowerShell.Utility.Write-Debug diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index d512ef60930c..4739521aaa22 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -630,8 +630,8 @@ Examples: More complex examples: ```powershell -$DomainServers = "ContosoDC1","ContosoDC2","ContosoFileServer","ContosoDNS", - "ContosoDHCP","ContosoWSUS" +$DomainServers = "ContosoDC1", "ContosoDC2", "ContosoFileServer", + "ContosoDNS", "ContosoDHCP", "ContosoWSUS" $thisComputer = "ContosoDC2" $DomainServers -contains $thisComputer @@ -681,8 +681,8 @@ The following examples do the same thing that the examples for `-contains` and More complex examples: ```powershell -$DomainServers = "ContosoDC1","ContosoDC2","ContosoFileServer","ContosoDNS", - "ContosoDHCP","ContosoWSUS" +$DomainServers = "ContosoDC1", "ContosoDC2", "ContosoFileServer", + "ContosoDNS", "ContosoDHCP", "ContosoWSUS" $thisComputer = "ContosoDC2" $thisComputer -in $DomainServers diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md index 35266557d053..63807a23ccc1 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Continue.md @@ -88,13 +88,13 @@ is **True** and iteration continues with the second `for` loop at `labelB`. ## Using continue in a switch statement An unlabeled `continue` statement within a `switch` terminates execution of the -current `switch` iteration and transfers control to the top of the `switch` to get -the next input item. +current `switch` iteration and transfers control to the top of the `switch` to +get the next input item. -When there is a single input item `continue` exits the entire `switch` statement. -When the `switch` input is a collection, the `switch` tests each element of the -collection. The `continue` exits the current iteration and the `switch` continues -with the next element. +When there is a single input item `continue` exits the entire `switch` +statement. When the `switch` input is a collection, the `switch` tests each +element of the collection. The `continue` exits the current iteration and the +`switch` continues with the next element. ```powershell switch (1,2,3) { diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md index dd47b9446659..052731dcb306 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md @@ -9,6 +9,7 @@ title: about_Data_Files # about_Data_Files ## Short description + PowerShell data files are used to store arbitrary data using PowerShell syntax. ## Long description @@ -47,10 +48,10 @@ the commands and variables that can be used. For more information, see [about_Language_Modes][02]. -Originally, localized data files were meant to be used to store string data that -could be translated into other languages. This allowed your scripts to import -the data to provide localized string output in other languages. However, you -aren't limited to storing string data and don't have to use the data for +Originally, localized data files were meant to be used to store string data +that could be translated into other languages. This allowed your scripts to +import the data to provide localized string output in other languages. However, +you aren't limited to storing string data and don't have to use the data for localized output. The data in the file isn't limited to hashtables. It can be in any format diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md index e349f7431b45..2587d906833c 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md @@ -98,8 +98,8 @@ DATA -supportedCommand Format-Xml ### Using a `DATA` Section -To use the content of a `DATA` section, assign it to a variable and use variable -notation to access the content. +To use the content of a `DATA` section, assign it to a variable and use +variable notation to access the content. For example, the following `DATA` section contains a `ConvertFrom-StringData` command that converts the here-string into a hash table. The hash table is @@ -173,7 +173,7 @@ A single-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell DATA { - ConvertFrom-StringData -stringdata @' + ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 '@ @@ -184,7 +184,7 @@ A double-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell DATA { - ConvertFrom-StringData -stringdata @" + ConvertFrom-StringData -StringData @" Msg1 = To start, press any key. Msg2 = To exit, type "quit". "@ @@ -195,7 +195,7 @@ A data section that includes a user-written cmdlet that generates data: ```powershell DATA -supportedCommand Format-XML { - Format-Xml -strings string1, string2, string3 + Format-Xml -Strings string1, string2, string3 } ``` diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md index 61a71c88ebb3..7f2e428624c3 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md @@ -192,7 +192,7 @@ For example, the following command gets the variables in the local (script) scope: ```powershell -Get-Variable -scope 0 +Get-Variable -Scope 0 ``` This is a useful way to see only the variables that you defined in the script @@ -310,17 +310,17 @@ For example: ```powershell function test-cmdlet { begin { - write-output "Begin" + Write-Output "Begin" } process { - write-output "Process" + Write-Output "Process" } end { - write-output "End" + Write-Output "End" } } -C:\PS> Set-PSBreakpoint -command test-cmdlet +C:\PS> Set-PSBreakpoint -Command test-cmdlet C:\PS> test-cmdlet @@ -370,7 +370,7 @@ identifying changes to the prompt: ```powershell Enter-PSSession -Cn localhost -[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6,11,22,25 +[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6, 11, 22, 25 ID Script Line Command Variable Action -- ------ ---- ------- -------- ------ @@ -452,7 +452,7 @@ Start by creating a line breakpoint on the first line of the Test.ps1 script in the current directory. ```powershell -PS C:\ps-test> Set-PSBreakpoint -line 1 -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Line 1 -Script test.ps1 ``` The command returns a **System.Management.Automation.LineBreakpoint** object. @@ -567,7 +567,7 @@ reuse the breakpoint, use the `Disable-PsBreakpoint` cmdlet instead of `Remove-PsBreakpoint`.) ```powershell -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint ``` You can abbreviate this command as: @@ -586,13 +586,13 @@ function delbr { gbp | rbp } Now, create a breakpoint on the `$scriptname` variable. ```powershell -PS C:\ps-test> Set-PSBreakpoint -variable scriptname -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Variable scriptname -Script test.ps1 ``` You can abbreviate the command as: ```powershell -PS C:\ps-test> sbp -v scriptname -s test.ps1 +PS C:\ps-test> sbp -V scriptname -S test.ps1 ``` Now, start the script. The script reaches the variable breakpoint. The default @@ -642,8 +642,8 @@ Have you run a background job today (start-job)? test.ps1:13 "Done $scriptName" ``` -The `StepOver` command executes the function, and it previews the next statement -in the script, which prints the final line. +The `StepOver` command executes the function, and it previews the next +statement in the script, which prints the final line. Use a `Stop` command (`t`) to exit the debugger. The command prompt reverts to the standard command prompt. @@ -656,19 +656,19 @@ To delete the breakpoints, use the `Get-PsBreakpoint` and `Remove-PsBreakpoint` cmdlets. ```powershell -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint ``` Create a new command breakpoint on the `psversion` function. ```powershell -PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 ``` You can abbreviate this command to: ```powershell -PS C:\ps-test> sbp -c psversion -s test.ps1 +PS C:\ps-test> sbp -C psversion -S test.ps1 ``` Now, run the script. @@ -697,7 +697,7 @@ Windows PowerShell 2.0 Have you run a background job today (start-job)? Done C:\ps-test\test.ps1 -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint PS C:\ps-test> ``` @@ -708,9 +708,9 @@ the action, execution doesn't stop. The backtick (`` ` ``) is the line-continuation character. ```powershell -PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 ` --action { add-content "The value of `$scriptName is $scriptName." ` --path action.log} +PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 ` +-Action { Add-Content "The value of `$scriptName is $scriptName." ` +-Path action.log} ``` You can also add actions that set conditions for the breakpoint. In the @@ -719,8 +719,8 @@ policy is set to RemoteSigned, the most restrictive policy that still permits you to run scripts. ```powershell -PS C:\ps-test> Set-PSBreakpoint -script test.ps1 -command psversion ` --action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }} +PS C:\ps-test> Set-PSBreakpoint -Script test.ps1 -Command psversion ` +-Action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }} ``` The `break` keyword in the action directs the debugger to execute the @@ -785,7 +785,7 @@ features that you can use to debug scripts and functions. [01]: /powershell/scripting/dev-cross-plat/vscode/using-vscode#debugging-with-visual-studio-code -[02]: about_prompts.md +[02]: about_Prompts.md [05]: xref:Microsoft.PowerShell.Utility.Disable-PSBreakpoint [06]: xref:Microsoft.PowerShell.Utility.Enable-PSBreakpoint [07]: xref:Microsoft.PowerShell.Utility.Get-PSBreakpoint diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Provider.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Provider.md index 3ef2652630f0..d9a254b1cf3a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Provider.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Provider.md @@ -26,31 +26,34 @@ Provides access to the Windows environment variables. ## Detailed description -The PowerShell **Environment** provider lets you get, add, change, clear, and delete environment -variables and values in PowerShell. +The PowerShell **Environment** provider lets you get, add, change, clear, and +delete environment variables and values in PowerShell. -**Environment** variables are dynamically named variables that describe the environment in which your programs run. Windows and PowerShell use environment variables to store persistent information that affect system -and process execution. Unlike PowerShell variables, environment variables are not subject to scope constraints. +**Environment** variables are dynamically named variables that describe the +environment in which your programs run. Windows and PowerShell use environment +variables to store persistent information that affect system and process +execution. Unlike PowerShell variables, environment variables are not subject +to scope constraints. -The **Environment** drive is a flat namespace containing the environment variables specific to the current user's session. The environment variables +The **Environment** drive is a flat namespace containing the environment +variables specific to the current user's session. The environment variables have no child items. The **Environment** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] ## Types exposed by this provider Each environment variable is an instance of the -[System.Collections.DictionaryEntry](/dotnet/api/system.collections.dictionaryentry) -class. The name of the variable is the dictionary key. The value of the -environment variable is the dictionary value. +[System.Collections.DictionaryEntry][07] class. The name of the variable is the +dictionary key. The value of the environment variable is the dictionary value. ## Navigating the Environment drive @@ -71,10 +74,11 @@ Set-Location C: ``` You can also work with the **Environment** provider from any other PowerShell -drive. To reference an environment variable from another location, use the drive name `Env:` in the path. +drive. To reference an environment variable from another location, use the +drive name `Env:` in the path. -The **Environment** provider also exposes environment variables using a variable -prefix of `$env:`. The following command views the contents of the +The **Environment** provider also exposes environment variables using a +variable prefix of `$env:`. The following command views the contents of the **ProgramFiles** environment variable. The `$env:` variable prefix can be used from any PowerShell drive. @@ -90,9 +94,8 @@ session for as long as it is active. > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is -> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][08], `cd` is an alias for [Set-Location][02] and `pwd` is +> an alias for [Get-Location][01]. ## Getting environment variables @@ -199,8 +202,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path` -parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive. +[Get-Help][09] command in a file system drive or use the `-Path` parameter of +[Get-Help][09] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -212,4 +215,16 @@ Get-Help Get-ChildItem -Path env: ## See also -- [about_Providers](about_Providers.md) +- [about_Providers][10] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: /dotnet/api/system.collections.dictionaryentry +[08]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[09]: xref:Microsoft.PowerShell.Core.Get-Help +[10]: about_Providers.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 7e9f9cc6b4ae..b9f9e4c1feb4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -452,8 +452,8 @@ The environment variables that store preferences include: [03]: #powershell-environment-variables [04]: about_Environment_Provider.md [05]: about_Execution_Policies.md -[06]: about_preference_variables.md -[07]: about_profiles.md +[06]: about_Preference_Variables.md +[07]: about_Profiles.md [08]: about_PSModulePath.md -[11]: about_variables.md +[11]: about_Variables.md [14]: xref:PowerShellGet.Install-Module diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Execution_Policies.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Execution_Policies.md index cc766c620f99..582083ac6fa4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Execution_Policies.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Execution_Policies.md @@ -350,8 +350,7 @@ Beginning in PowerShell 3.0, you can use the **Stream** parameter of the from the internet. Use the `Unblock-File` cmdlet to unblock the scripts so that you can run them in PowerShell. -For more information, see [about_Signing][04], -[Get-Item][05], and +For more information, see [about_Signing][04], [Get-Item][05], and [Unblock-File][08]. > [!NOTE] diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md index 1990dc1fad11..24df354cb822 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md @@ -677,7 +677,7 @@ Get-Help Get-ChildItem -Path c: - [about_Providers][08] - + [01]: /dotnet/api/system.datetime [02]: /dotnet/api/system.io.directoryinfo [03]: /dotnet/api/system.io.fileattributes diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_For.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_For.md index 2f815abae42c..f19d73a2136a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_For.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_For.md @@ -9,6 +9,7 @@ title: about_For # about_For ## Short description + Describes a language command you can use to run statements based on a conditional test. @@ -117,7 +118,7 @@ for (($i = 0), ($j = 0); $i -lt 10 -and $j -lt 10; $i++,$j++) } ``` -For more information, see [about_Logical_Operators](about_Logical_Operators.md). +For more information, see [about_Logical_Operators][01]. ### Syntax examples @@ -224,7 +225,7 @@ for ($i = 0; $i -le 20; $i += 2) The `For` loop can also be written on one line as in the following example. ```powershell -for ($i = 0; $i -lt 10; $i++) { Write-Host $i } +for ($i = 0; $i -lt 10; $i++){Write-Host $i} ``` ### Functional example @@ -355,7 +356,7 @@ properties: index. ```powershell -$paddedList = Get-ChildItem -path ./work_items +$paddedList = Get-ChildItem -Path ./work_items # Sort both file lists by name. $sortedOriginal = $fileList | Sort-Object -Property Name @@ -405,5 +406,10 @@ In the output, the sorted work items after padding are in the expected order. ## See also -- [about_Comparison_Operators](about_Comparison_Operators.md) -- [about_Foreach](about_Foreach.md) +- [about_Comparison_Operators][02] +- [about_Foreach][03] + + +[01]: about_Logical_Operators.md +[02]: about_Comparison_Operators.md +[03]: about_Foreach.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md index de6c2c452a41..2584b961097b 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Foreach.md @@ -9,6 +9,7 @@ title: about_Foreach # about_Foreach ## Short description + Describes a language command you can use to traverse all the items in a collection of items. @@ -104,8 +105,8 @@ counts files over 100 KB in size: ```powershell $i = 0 foreach ($file in Get-ChildItem) { - if ($file.length -gt 100KB) { - Write-Host $file 'file size:' ($file.length / 1024).ToString('F0') KB + if ($file.Length -gt 100KB) { + Write-Host $file 'file size:' ($file.Length / 1024).ToString('F0') KB $i = $i + 1 } } @@ -127,7 +128,7 @@ display a count of files over 100KB. The previous example also demonstrates how to format the file length results: ```powershell -($file.length / 1024).ToString('F0') +($file.Length / 1024).ToString('F0') ``` The value is divided by 1,024 to show the results in kilobytes rather than diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index ef732ca644ed..c64e56b4a208 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -570,10 +570,21 @@ Update-FormatData -PrependPath $PSHOME\Format\MyFileSystem.Format.ps1xml ## See also -- [Trace-Command](xref:Microsoft.PowerShell.Utility.Trace-Command) -- [Export-FormatData](xref:Microsoft.PowerShell.Utility.Export-FormatData) -- [Get-FormatData](xref:Microsoft.PowerShell.Utility.Get-FormatData) -- [Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData) -- [Get-TraceSource](xref:Microsoft.PowerShell.Utility.Get-TraceSource) -- [Format Schema XML Reference](/powershell/scripting/developer/format/format-schema-xml-reference) -- [Writing a PowerShell Formatting File](/powershell/scripting/developer/format/writing-a-powershell-formatting-file) +- [Trace-Command][05] +- [Export-FormatData][02] +- [Get-FormatData][01] +- [Update-FormatData][03] +- [Get-TraceSource][06] +- [Format Schema XML Reference][09] +- [Writing a PowerShell Formatting File][10] + + +[01]: xref:Microsoft.PowerShell.Utility.Get-FormatData +[02]: xref:Microsoft.PowerShell.Utility.Export-FormatData +[03]: xref:Microsoft.PowerShell.Utility.Update-FormatData + +[05]: xref:Microsoft.PowerShell.Utility.Trace-Command +[06]: xref:Microsoft.PowerShell.Utility.Get-TraceSource + +[09]: /powershell/scripting/developer/format/format-schema-xml-reference +[10]: /powershell/scripting/developer/format/writing-a-powershell-formatting-file diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md index f70617f8fea7..464284e3519e 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Function_Provider.md @@ -40,20 +40,18 @@ and filter objects. Neither functions nor filters have child items. The **Function** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] ## Types exposed by this provider Each function is an instance of the -[System.Management.Automation.FunctionInfo](/dotnet/api/system.management.automation.functioninfo) -class. Each filter is an instance of the -[System.Management.Automation.FilterInfo](/dotnet/api/system.management.automation.filterinfo) -class. +[System.Management.Automation.FunctionInfo][07] class. Each filter is an +instance of the [System.Management.Automation.FilterInfo][08] class. ## Navigating the Function drive @@ -80,9 +78,8 @@ drive. To reference a function from another location, use the drive name > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is -> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][09], `cd` is an alias for [Set-Location][10] and `pwd` is +> an alias for [Get-Location][01]. ## Getting functions @@ -126,11 +123,11 @@ ${function:Clear-Host} This command gets the `man` function from the `Function:` drive. It uses the `Get-Item` cmdlet to get the function. The pipeline operator (`|`) sends the result to `Format-Table`. The `-Wrap` parameter directs text that does not fit -on the line onto the next line. The `-Autosize` parameter resizes the table +on the line onto the next line. The `-AutoSize` parameter resizes the table columns to accommodate the text. ```powershell -Get-Item -Path man | Format-Table -Wrap -Autosize +Get-Item -Path man | Format-Table -Wrap -AutoSize ``` ### Working with Function provider paths @@ -223,9 +220,9 @@ Determines the value of the **Options** property of a function. ### Cmdlets supported -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) +- [New-Item][04] -- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item) +- [Set-Item][11] ## Using the pipeline @@ -240,8 +237,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path` -parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive. +[Get-Help][12] command in a file system drive or use the `-Path` parameter of +[Get-Help][12] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -253,5 +250,21 @@ Get-Help Get-ChildItem -Path function: ## See also -- [about_Functions](about_Functions.md) -- [about_Providers](about_Providers.md) +- [about_Functions][13] +- [about_Providers][14] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: /dotnet/api/system.management.automation.functioninfo +[08]: /dotnet/api/system.management.automation.filterinfo +[09]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[10]: xref:Microsoft.PowerShell.Management.Set-Location +[11]: xref:Microsoft.PowerShell.Management.Set-Item +[12]: xref:Microsoft.PowerShell.Core.Get-Help +[13]: about_Functions.md +[14]: about_Providers.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md index ee1b8956f31a..4a99c9933b9a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md @@ -1,7 +1,7 @@ --- description: Describes how to create and use functions in PowerShell. Locale: en-US -ms.date: 06/10/2024 +ms.date: 06/26/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Functions @@ -467,7 +467,7 @@ function Get-Pipeline process {"The value is: $_"} } -1,2,4 | Get-Pipeline +1, 2, 4 | Get-Pipeline ``` ```Output @@ -500,9 +500,9 @@ function Get-SumOfNumbers { end { $retValue } } -PS> 1,2,3,4 | Get-SumOfNumbers +PS> 1, 2, 3, 4 | Get-SumOfNumbers 10 -PS> Get-SumOfNumbers 1,2,3,4 +PS> Get-SumOfNumbers 1, 2, 3, 4 10 ``` @@ -526,7 +526,7 @@ If this function is run using the pipeline, it displays the following results: ```powershell -1,2,4 | Get-PipelineBeginEnd +1, 2, 4 | Get-PipelineBeginEnd ``` ```Output @@ -555,7 +555,7 @@ object at a time. The `$input` automatic variable is empty when the function reaches the `end` keyword. ```powershell -1,2,4 | Get-PipelineInput +1, 2, 4 | Get-PipelineInput ``` ```Output @@ -725,7 +725,7 @@ You can write help for a function using either of the two following methods: [05]: about_Automatic_Variables.md [06]: about_Automatic_Variables.md#using-enumerators [07]: about_Comment_Based_Help.md -[08]: about_Function_provider.md +[08]: about_Function_Provider.md [09]: about_Functions_Advanced_Methods.md [10]: about_Functions_Advanced_Parameters.md [11]: about_Functions_Advanced.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md index f625a3a28ba0..876319523e2b 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md @@ -9,13 +9,14 @@ title: about_Functions_Advanced # about_Functions_Advanced ## Short description + Introduces advanced functions that are a way to create cmdlets using scripts. ## Long description A cmdlet is a single command that participates in the pipeline semantics of -PowerShell. This includes binary cmdlets, PowerShell advanced script -functions, CDXML, and Workflows. +PowerShell. This includes binary cmdlets, PowerShell advanced functions, +CDXML, and Workflows. Advanced functions allow you create cmdlets that are written as a PowerShell function. Advanced functions make it easier to create cmdlets without having to @@ -45,7 +46,7 @@ function Send-Greeting [CmdletBinding()] param( [Parameter(Mandatory=$true)] - [string] $Name + [string]$Name ) process diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md index 20ddd6c7baf2..550020405cb7 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md @@ -119,7 +119,7 @@ function Get-SumOfNumbers { end { $retValue } } -PS> Get-SumOfNumbers 1,2,3,4 +PS> Get-SumOfNumbers 1, 2, 3, 4 10 PS> 1,2,3,4 | Get-SumOfNumbers 10 diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md index 9f52147f0299..001423f1f879 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md @@ -1255,7 +1255,7 @@ True - [about_Functions_OutputTypeAttribute][13] -[01]: about_comment_based_help.md +[01]: about_Comment_Based_Help.md [02]: /dotnet/api/system.management.automation.runtimedefinedparameter [05]: about_Automatic_Variables.md [06]: about_CommonParameters.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md index abebf43d3c35..2f9f468381ef 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md @@ -9,6 +9,7 @@ title: About_functions_argument_completion # about_Functions_Argument_Completion ## Short description + Argument completion is a feature of PowerShell that provide hints, enables discovery, and speeds up input entry of argument values. @@ -39,8 +40,7 @@ example, the value of the **Fruit** parameter can only be **Apple**, Param( [Parameter(Mandatory=$true)] [ValidateSet('Apple', 'Banana', 'Pear')] - [string[]] - $Fruit + [string[]]$Fruit ) ``` @@ -50,7 +50,7 @@ be used on any variable, not just parameters. ```powershell [ValidateSet('Chocolate', 'Strawberry', 'Vanilla')] -[string]$flavor = 'Strawberry' +[string]$Flavor = 'Strawberry' ``` The validation occurs whenever that variable is assigned even within the diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Hash_Tables.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Hash_Tables.md index abed1a09a0aa..45eb67522d2b 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Hash_Tables.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Hash_Tables.md @@ -10,6 +10,7 @@ title: about_Hash_Tables # about_Hash_Tables ## Short description + Describes how to create, use, and sort hashtables in PowerShell. ## Long description @@ -314,9 +315,9 @@ member notation or array index notation. ### Handling property name collisions If the key name collides with one of the property names of the **HashTable** -type, you can use the **psbase** [intrinsic member](about_Intrinsic_Members.md) -to access those properties. For example, if the key name is `keys` and you want -to return the collection of the **HashTable** keys, use this syntax: +type, you can use the **psbase** [intrinsic member][01] to access those +properties. For example, if the key name is `keys` and you want to return the +collection of the **HashTable** keys, use this syntax: ```powershell $hashtable.psbase.Keys @@ -332,7 +333,7 @@ ways. Each of the examples in this section has identical output. They iterate over the `$hash` variable defined here: ```powershell -$hash = [ordered]@{ Number = 1; Shape = "Square"; Color = "Blue"} +$hash = [ordered]@{Number = 1; Shape = "Square"; Color = "Blue"} ``` > [!NOTE] @@ -476,7 +477,7 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 441 24 54196 54012 571 5.10 1788 PowerShell -PS> $p.keys | ForEach-Object {$p.$_.handles} +PS> $p.Keys | ForEach-Object {$p.$_.Handles} 441 251 ``` @@ -504,7 +505,7 @@ PowerShell System.Diagnostics.Process (powershell) Notepad System.Diagnostics.Process (Notepad) WinRM Running -PS> $p.keys +PS> $p.Keys PowerShell Notepad @@ -512,7 +513,7 @@ Status Name DisplayName ------ ---- ----------- Running winrm Windows Remote Management (WS-Manag... -PS> $p.keys | ForEach-Object {$_.name} +PS> $p.Keys | ForEach-Object {$_.Name} WinRM ``` @@ -605,7 +606,7 @@ The syntax is as follows: This method works only for classes that have a constructor that has no parameters. The object properties must be public and settable. -For more information, see [about_Object_Creation](about_Object_Creation.md). +For more information, see [about_Object_Creation][02]. ## ConvertFrom-StringData @@ -617,7 +618,7 @@ cmdlet safely in the Data section of a script, and you can use it with the Here-strings are especially useful when the values in the hashtable include quotation marks. For more information about here-strings, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][03]. The following example shows how to create a here-string of the user messages in the previous example and how to use `ConvertFrom-StringData` to convert them @@ -647,16 +648,25 @@ Msg2 She said, "Hello, World." Msg1 Type "Windows". ``` -For more information about here-strings, see -[about_Quoting_Rules](about_Quoting_Rules.md). +For more information about here-strings, see [about_Quoting_Rules][03]. ## See also -- [about_Arrays](about_Arrays.md) -- [about_Intrinsic_Members](about_Intrinsic_Members.md) -- [about_Object_Creation](about_Object_Creation.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Script_Internationalization](about_Script_Internationalization.md) -- [Import-LocalizedData](xref:Microsoft.PowerShell.Utility.Import-LocalizedData) -- [ConvertFrom-StringData](xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData) -- [System.Collections.Hashtable](/dotnet/api/system.collections.hashtable) +- [about_Arrays][04] +- [about_Intrinsic_Members][01] +- [about_Object_Creation][02] +- [about_Quoting_Rules][03] +- [about_Script_Internationalization][05] +- [Import-LocalizedData][06] +- [ConvertFrom-StringData][07] +- [System.Collections.Hashtable][08] + + +[01]: about_Intrinsic_Members.md +[02]: about_Object_Creation.md +[03]: about_Quoting_Rules.md +[04]: about_Arrays.md +[05]: about_Script_Internationalization.md +[06]: xref:Microsoft.PowerShell.Utility.Import-LocalizedData +[07]: xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData +[08]: /dotnet/api/system.collections.hashtable diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Hidden.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Hidden.md index 32279787fa8a..8fb72080ce18 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Hidden.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Hidden.md @@ -9,6 +9,7 @@ title: about_Hidden # about_Hidden ## Short description + Describes the `hidden` keyword, which hides class members from default `Get-Member` results. @@ -16,9 +17,9 @@ Describes the `hidden` keyword, which hides class members from default When you use the `hidden` keyword in a script, you hide the members of a class by default. Hidden members do not display in the default results of the -`Get-Member` cmdlet, IntelliSense, or tab completion results. To display members -that you have hidden with the `hidden` keyword, add the **Force** parameter to a -`Get-Member` command. +`Get-Member` cmdlet, IntelliSense, or tab completion results. To display +members that you have hidden with the `hidden` keyword, add the **Force** +parameter to a `Get-Member` command. The `hidden` keyword can hide: @@ -47,11 +48,12 @@ PowerShell 5.0. ## EXAMPLE The following example shows how to use the `hidden` keyword in a class -definition. The **Car** class method, **Drive**, has a property, **rides**, that -does not need to be viewed or changed as it merely tallies the number of times -that **Drive** is called on the **Car** class. That metric that is not important -to users of the class (consider, for example, that when you are buying a car, -you do not ask the seller on how many drives the car has been taken). +definition. The **Car** class method, **Drive**, has a property, **rides**, +that does not need to be viewed or changed as it merely tallies the number of +times that **Drive** is called on the **Car** class. That metric that is not +important to users of the class (consider, for example, that when you are +buying a car, you do not ask the seller on how many drives the car has been +taken). Because there is little need for users of the class to change this property, we can hide the property from `Get-Member` and automatic completion results by @@ -113,8 +115,8 @@ ModelYear Property string ModelYear {get;set;} ``` Now, try running `Get-Member` again, but this time, add the `-Force` parameter. -Note that the results contain the hidden **rides** property, among other members -that are hidden by default. +Note that the results contain the hidden **rides** property, among other +members that are hidden by default. ```output PS C:\Windows\system32> $TestCar | Get-Member -Force diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_History.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_History.md index e76a4ccc1dee..82429cb29c70 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_History.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_History.md @@ -9,6 +9,7 @@ title: about_History # about_History ## Short description + Describes how to get and run commands in the command history. ## Long description @@ -28,13 +29,13 @@ The PSReadLine history tracks the commands used in all PowerShell sessions. The history is written to a central file per host. That history file is available to all sessions and contains all past history. The history is not deleted when the session ends. Also, that history cannot be managed by the -`*-History` cmdlets. For more information, see -[about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md). +`*-History` cmdlets. For more information, see [about_PSReadLine][01]. ## Using the built-in session history The built-in history only tracks the commands used in the current session. The -history is not available to other sessions and is deleted when the session ends. +history is not available to other sessions and is deleted when the session +ends. ### History Cmdlets @@ -71,7 +72,7 @@ command history. > module. PSReadLine loads automatically when you start a PowerShell session. > With PSReadLine loaded, F7 and F9 are not bound to any > function. PSReadLine does not provide equivalent functionality. For more -> information, see [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md). +> information, see [about_PSReadLine][01]. ### MaximumHistoryCount @@ -90,10 +91,10 @@ To apply the setting, restart PowerShell. To save the new variable value for all your PowerShell sessions, add the assignment statement to a PowerShell profile. For more information about -profiles, see [about_Profiles](about_Profiles.md). +profiles, see [about_Profiles][02]. For more information about the `$MaximumHistoryCount` preference variable, see -[about_Preference_Variables](about_Preference_Variables.md). +[about_Preference_Variables][03]. ### Order of Commands in the History @@ -105,8 +106,15 @@ completed only when you exit the prompt level. ## See also -- [about_Line_Editing](about_Line_Editing.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md) -- [about_Variables](about_Variables.md) +- [about_Line_Editing][04] +- [about_Preference_Variables][03] +- [about_Profiles][02] +- [about_PSReadLine][01] +- [about_Variables][05] + + +[01]: ../../PSReadLine/About/about_PSReadLine.md +[02]: about_Profiles.md +[03]: about_Preference_Variables.md +[04]: about_Line_Editing.md +[05]: about_Variables.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Job_Details.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Job_Details.md index d55c5cbf8439..f218931b93b8 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Job_Details.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Job_Details.md @@ -144,14 +144,15 @@ start the job. - When you use `Start-Job` to start a job on a local computer, the job consists of an executive parent job and a child job that runs the command. -- When you use the **AsJob** parameter of `Invoke-Command` to start a job on one or - more computers, the job consists of an executive parent job and a child job - for each job run on each computer. +- When you use the **AsJob** parameter of `Invoke-Command` to start a job on + one or more computers, the job consists of an executive parent job and a + child job for each job run on each computer. -- When you use `Invoke-Command` to run a `Start-Job` command on one or more remote - computers, the result is the same as a local command run on each remote - computer. The command returns a job object for each computer. The job object - consists of an executive parent job and one child job that runs the command. +- When you use `Invoke-Command` to run a `Start-Job` command on one or more + remote computers, the result is the same as a local command run on each + remote computer. The command returns a job object for each computer. The job + object consists of an executive parent job and one child job that runs the + command. The parent job represents all of the child jobs. When you manage a parent job, you also manage the associated child jobs. For example, if you stop a parent @@ -238,10 +239,10 @@ exist only in a particular session. Workflow jobs can be suspended and resumed. The cmdlets that you use to manage custom jobs depend on the job type. For -some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. Others -come with specialized cmdlets that manage only a particular type of job. For -detailed information about custom job types, see the help topics about the job -type. +some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. +Others come with specialized cmdlets that manage only a particular type of job. +For detailed information about custom job types, see the help topics about the +job type. To find the job type of a job, use the `Get-Job` cmdlet. `Get-Job` returns different job objects for different types of jobs. The value of the @@ -264,9 +265,10 @@ The following table lists the job types that come with PowerShell. | PSEventJob | Created using`Register-ObjectEvent` and specifying an | | | action with the **Action** parameter. | -NOTE: Before using the `Get-Job` cmdlet to get jobs of a particular type, verify -that the module that adds the job type is imported into the current session. -Otherwise, `Get-Job` does not get jobs of that type. +> [!NOTE] +> Before using the `Get-Job` cmdlet to get jobs of a particular type, verify +> that the module that adds the job type is imported into the current session. +> Otherwise, `Get-Job` does not get jobs of that type. ## Examples diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Join.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Join.md index 8231ff3267c6..254e54b874c9 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Join.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Join.md @@ -25,8 +25,8 @@ in the command. The following diagram shows the syntax for the join operator. ```powershell --Join - -Join +-join + -join ``` #### Parameters diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md index 0136e6984130..8e32fe129626 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Modes.md @@ -10,6 +10,7 @@ title: about_Language_Modes # about_Language_Modes ## Short description + Explains language modes and their effect on PowerShell sessions. ## Long description @@ -338,7 +339,7 @@ Beginning in PowerShell 7.2, the `New-Object` cmdlet is disabled in [01]: /powershell/scripting/learn/remoting/jea/session-configurations -[02]: about_member-access_enumeration.md +[02]: about_Member-Access_Enumeration.md [03]: about_Session_Configuration_Files.md [04]: about_Session_Configurations.md [05]: xref:Microsoft.PowerShell.Core.New-PSSessionConfigurationFile diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md index 7a26fdcba381..4c5f03c4d6fc 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md @@ -57,8 +57,8 @@ During member-access enumeration for a property, the operator returns the value of the property for each item that has that property. If no items have the specified property, the operator returns `$null`. -During member-access enumeration for a method, the operator attempts to call the -method on each item in the collection. If any item in the collection does +During member-access enumeration for a method, the operator attempts to call +the method on each item in the collection. If any item in the collection does not have the specified method, the operator returns the **MethodNotFound** exception. @@ -338,7 +338,7 @@ in the array. ### Collections containing PSCustomObject instances If the collection of objects contains instances of **PSCustomObject** items, -PowerShell unexpectedly retruns `$null` values when the accessed property is +PowerShell unexpectedly returns `$null` values when the accessed property is missing. In the following examples at least one object has the referenced property. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Methods.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Methods.md index a8b2ba369f2a..81109a27d954 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Methods.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Methods.md @@ -9,6 +9,7 @@ title: about_Methods # about_Methods ## Short description + Describes how to use methods to perform actions on objects in PowerShell. ## Long description @@ -114,8 +115,8 @@ two method signatures: ``` The first method signature takes the destination file name (and a path). The -following example uses the first `CopyTo` method to copy the `Final.txt` file to -the `C:\Bin` directory. +following example uses the first `CopyTo` method to copy the `Final.txt` file +to the `C:\Bin` directory. ```powershell (Get-ChildItem c:\final.txt).CopyTo("c:\bin\final.txt") diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Module_Manifests.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Module_Manifests.md index 4a7099b269a2..d910d75328fa 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Module_Manifests.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Module_Manifests.md @@ -9,6 +9,7 @@ title: about_Module_Manifests # about_Module_Manifests ## Short description + Describes the settings and practices for writing module manifest files. ## Long description @@ -158,7 +159,7 @@ By default, all module members in the **RootModule** are exported. > [!TIP] > Module loading speed differs between **Binary**, **Script**, and **CIM** > module types. For more information, see -> [PowerShell module authoring considerations][05] +> [PowerShell module authoring considerations][04] For example, this module's **ModuleType** is **Manifest**. The only module members this module can export are those defined in the modules specified with @@ -234,7 +235,7 @@ values. For information about PSEdition, see: -- [about_PowerShell_Editions][04] +- [about_PowerShell_Editions][09] - [Modules with compatible PowerShell Editions][02]. When this setting is defined, the module can only be imported into a session @@ -869,7 +870,7 @@ When you import the module, PowerShell runs the `Update-TypeData` cmdlet with the specified files. Because type files aren't scoped, they affect all session states in the session. -For more information on type files, see [about_Types.ps1xml][09] +For more information on type files, see [about_Types.ps1xml][10] For example, when you import this manifest, PowerShell loads the types specified in the `Example.ps1xml` file from the `Types` folder located in the @@ -1477,7 +1478,7 @@ The **PSData** child property is used for the following scenarios: module, `Export-CrescendoModule` adds the value `CrescendoBuilt` to the **PSData.Tags** property. You can use this tag to find modules in the PowerShell Gallery that were created using Crescendo. For more information, - see [Export-CrescendoModule][14]. + see [Export-CrescendoModule][15]. ### HelpInfoURI @@ -1499,8 +1500,8 @@ in PowerShell 3.0. It contains information about the location of downloadable help files for the module and the version numbers of the newest help files for each supported locale. -For information about Updatable Help, see [about_Updatable_Help][10]. For -information about the HelpInfo XML file, see [Supporting Updatable Help][06]. +For information about Updatable Help, see [about_Updatable_Help][11]. For +information about the HelpInfo XML file, see [Supporting Updatable Help][05]. For example, this module supports updatable help. @@ -1540,24 +1541,25 @@ imported as `Get-ExampleItem`. ## See also -- [about_PowerShell_Editions][04] -- [New-ModuleManifest][12] -- [Test-ModuleManifest][13] +- [about_PowerShell_Editions][09] +- [New-ModuleManifest][13] +- [Test-ModuleManifest][14] - [Modules with compatible PowerShell Editions][02] - [Package manifest values that impact the PowerShell Gallery UI][03] -- [PowerShell module authoring considerations][05] +- [PowerShell module authoring considerations][04] [01]: /powershell/dsc/overview [02]: /powershell/gallery/concepts/module-psedition-support [03]: /powershell/gallery/concepts/package-manifest-affecting-ui -[04]: /powershell/module/microsoft.powershell.core/about/about_powershell_editions -[05]: /powershell/scripting/dev-cross-plat/performance/module-authoring-considerations -[06]: /powershell/scripting/developer/module/supporting-updatable-help +[04]: /powershell/scripting/dev-cross-plat/performance/module-authoring-considerations +[05]: /powershell/scripting/developer/module/supporting-updatable-help + [07]: about_Format.ps1xml.md [08]: about_Language_Modes.md -[09]: about_Types.ps1xml.md -[10]: about_Updatable_Help.md -[12]: xref:Microsoft.PowerShell.Core.New-ModuleManifest -[13]: xref:Microsoft.PowerShell.Core.Test-ModuleManifest -[14]: xref:Microsoft.PowerShell.Crescendo.Export-CrescendoModule +[09]: /powershell/module/microsoft.powershell.core/about/about_powershell_editions +[10]: about_Types.ps1xml.md +[11]: about_Updatable_Help.md +[13]: xref:Microsoft.PowerShell.Core.New-ModuleManifest +[14]: xref:Microsoft.PowerShell.Core.Test-ModuleManifest +[15]: xref:Microsoft.PowerShell.Crescendo.Export-CrescendoModule diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Modules.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Modules.md index d1546cf66afd..82fa93d9e873 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Modules.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Modules.md @@ -9,6 +9,7 @@ title: about_Modules # about_Modules ## Short description + Explains how to install, import, and use PowerShell modules. ## Long description @@ -242,8 +243,7 @@ For example, to find the commands in the **BitsTransfer** module, type: Get-Command -Module BitsTransfer ``` -For more information about the `Get-Command` cmdlet, see -[Get-Command][11]. +For more information about the `Get-Command` cmdlet, see [Get-Command][11]. ## Remove a module diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md index 1b86b364f35b..4a08d9041007 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Object_Creation.md @@ -293,7 +293,7 @@ New-PSSession -ComputerName Server01 -SessionOption @{ IdleTimeout=43200000 SkipCnCheck=$True } -Register-ScheduledJob Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ +Register-ScheduledJob -Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ Frequency="Daily" At="15:00" } diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Objects.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Objects.md index e3fc68aa2321..45931d0ad731 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Objects.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Objects.md @@ -1,5 +1,5 @@ --- -description: Provides essential information about objects in Windows PowerShell. +description: Provides essential information about objects in PowerShell. Locale: en-US ms.date: 06/02/2021 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_objects?view=powershell-5.1&WT.mc_id=ps-gethelp @@ -11,11 +11,11 @@ title: about_Objects ## Short description -Provides essential information about objects in Windows PowerShell. +Provides essential information about objects in PowerShell. ## Long description -Every action you take in Windows PowerShell occurs within the context of +Every action you take in PowerShell occurs within the context of objects. As data moves from one command to the next, it moves as one or more identifiable objects. An object, then, is a collection of data that represents an item. An object is made up of three types of data: the @@ -39,7 +39,7 @@ in commands to take action and manage data. You can discover an objects properties and methods using [Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member) or the `psobject` - [intrinsic member](about_Intrinsic_Members.md). +[intrinsic member](about_Intrinsic_Members.md). ## Objects in Pipelines diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md index 203c66b7f986..6798de3f19dc 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md @@ -9,6 +9,7 @@ title: about_Operator_Precedence # about_Operator_Precedence ## Short description + Lists the PowerShell operators in precedence order. ## Long description @@ -120,8 +121,8 @@ $read_only = ( Get-ChildItem *.txt | Where-Object {$_.isReadOnly} ) Because the pipeline operator (`|`) has a higher precedence than the assignment operator (`=`), the files that the `Get-ChildItem` cmdlet gets are sent to the -`Where-Object` cmdlet for filtering before they are assigned to the `$read_only` -variable. +`Where-Object` cmdlet for filtering before they are assigned to the +`$read_only` variable. The following example demonstrates that the index operator takes precedence over the cast operator. @@ -192,7 +193,7 @@ are reading and maintaining your scripts. [assign]: about_Assignment_Operators.md [compare]: about_Comparison_Operators.md [join]: about_Join.md -[logic]: about_logical_operators.md +[logic]: about_Logical_Operators.md [ops]: about_Operators.md [redir]: about_Redirection.md [scopes]: about_Scopes.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md index 2d3f77043e90..f655cdaad95a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md @@ -273,10 +273,10 @@ For more information, see [about_Parsing][08]. This example stores a command in a string and executes it using the call operator. -``` -PS> $c = "get-executionpolicy" +```powershell +PS> $c = "Get-ExecutionPolicy" PS> $c -get-executionpolicy +Get-ExecutionPolicy PS> & $c AllSigned ``` @@ -284,7 +284,7 @@ AllSigned The call operator doesn't parse strings. This means that you can't use command parameters within a string when you use the call operator. -``` +```powershell PS> $c = "Get-Service -Name Spooler" PS> $c Get-Service -Name Spooler @@ -303,7 +303,7 @@ At line:1 char:2 The [Invoke-Expression][25] cmdlet can execute code that causes parsing errors when using the call operator. -``` +```powershell PS> & "1+1" &: The term '1+1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was @@ -324,7 +324,7 @@ the contents of the quoted string instead of running the script. The call operator allows you to execute the contents of the string containing the filename. -``` +```powershell PS C:\Scripts> Get-ChildItem Directory: C:\Scripts @@ -417,7 +417,7 @@ objects to be formatted on the right side of the operator. "{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi ``` -```output +```Output 1 hello 3.14 ``` @@ -429,7 +429,7 @@ formatted string to. "{0:00} {1:000} {2:000000}" -f 7, 24, 365 ``` -```output +```Output 07 024 000365 ``` @@ -454,7 +454,7 @@ value. Given a list of indices, the index operator returns a list of members corresponding to those indices. -``` +```powershell PS> $a = 1, 2, 3 PS> $a[0] 1 @@ -475,7 +475,7 @@ $h = @{key="value"; name="PowerShell"; version="2.0"} $h["name"] ``` -```output +```Output PowerShell ``` @@ -484,7 +484,7 @@ $x = [xml]"Once upon a time..." $x["doc"] ``` -```output +```Output intro ----- Once upon a time... @@ -494,7 +494,7 @@ When an object isn't an indexed collection, using the index operator to access the first element returns the object itself. Index values beyond the first element return `$null`. -``` +```powershell PS> (2)[0] 2 PS> (2)[-1] @@ -577,7 +577,7 @@ expression. ```powershell $myProcess.peakWorkingSet -(Get-Process PowerShell).kill() +(Get-Process PowerShell).Kill() 'OS', 'Platform' | Foreach-Object { $PSVersionTable. $_ } ``` @@ -620,9 +620,9 @@ properties and methods of an object, use the Static parameter of the [08]: about_Parsing.md [09]: about_Hash_Tables.md [12]: about_Join.md -[13]: about_logical_operators.md +[13]: about_Logical_Operators.md [14]: about_Member-Access_Enumeration.md -[15]: about_operator_precedence.md +[15]: about_Operator_Precedence.md [18]: about_Redirection.md [19]: about_Scopes.md [20]: about_Script_Blocks.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index 5d570c6c8eae..4aa1aa54ffaf 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -9,6 +9,7 @@ title: about_PSConsoleHostReadLine # about_PSConsoleHostReadLine ## Short description + Explains how to customize how PowerShell reads input at the console prompt. ## Long description diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSCustomObject.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSCustomObject.md index f6117bfe0414..c2854dd6e7c5 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSCustomObject.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSCustomObject.md @@ -9,6 +9,7 @@ title: about_PSCustomObject # about_PSCustomObject ## Short description + Explains the differences between the `[psobject]` and `[pscustomobject]` type accelerators. @@ -290,6 +291,6 @@ properties. [01]: about_Object_Creation.md [02]: about_Objects.md -[03]: about_type_accelerators.md +[03]: about_Type_Accelerators.md [04]: xref:System.Management.Automation.PSCustomObject [05]: xref:System.Management.Automation.PSObject diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSItem.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSItem.md index 32a5f693a91a..9281474c5c11 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_PSItem.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_PSItem.md @@ -40,9 +40,9 @@ cases. ## ForEach-Object Process -The [ForEach-Object][02] cmdlet is designed to operate -on objects in the pipeline, executing the **Process** parameter's scriptblock -once for every object in the pipeline. +The [ForEach-Object][02] cmdlet is designed to operate on objects in the +pipeline, executing the **Process** parameter's scriptblock once for every +object in the pipeline. You can use `$PSItem` in the **Process** parameter's scriptblock but not in the **Begin** or **End** parameter scriptblocks. If you reference `$PSItem` in the @@ -356,9 +356,9 @@ total. ## See also - [about_Arrays][04] -- [about_automatic_variables][01] +- [about_Automatic_Variables][01] - [about_Comparison_Operators][12] -- [about_functions][08] +- [about_Functions][08] - [about_Script_Blocks][14] - [about_Switch][07] - [ForEach-Object][02] diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_PackageManagement.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_PackageManagement.md index f447e4ff5978..fd3711bedbe8 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_PackageManagement.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_PackageManagement.md @@ -9,6 +9,7 @@ title: about_PackageManagement # about_PackageManagement ## Short description + PackageManagement is an aggregator for software package managers. ## Long description @@ -41,8 +42,7 @@ us define some terms: stored in a specific package source. The PackageManagement module includes the following cmdlets. For more -information, see the [PackageManagement](/powershell/module/packagemanagement) -help. +information, see the [PackageManagement][01] help. - `Get-PackageProvider`: Returns a list of package providers that are connected to PackageManagement. @@ -100,7 +100,7 @@ More Information About the PackageManagement Project For more information about the PackageManagement open development project, including how to create a PackageManagement package provider, see the -PackageManagement project on GitHub at https://oneget.org. +PackageManagement project on GitHub at [https://oneget.org][02]. ## See also @@ -114,3 +114,7 @@ PackageManagement project on GitHub at https://oneget.org. - [Register-PackageSource](xref:PackageManagement.Register-PackageSource) - [Set-PackageSource](xref:PackageManagement.Set-PackageSource) - [Unregister-PackageSource](xref:PackageManagement.Unregister-PackageSource) + + +[01]: /powershell/module/packagemanagement +[02]: https://oneget.org diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md index a4de95018602..919e4bc1e433 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md @@ -93,6 +93,6 @@ example, see the [Visualize parameter binding][01] article. [01]: /powershell/scripting/learn/deep-dives/visualize-parameter-binding -[02]: about_functions_advanced_parameters.md#valuefrompipeline-argument -[03]: about_functions_advanced_parameters.md#valuefrompipelinebypropertyname-argument +[02]: about_Functions_Advanced_Parameters.md#valuefrompipeline-argument +[03]: about_Functions_Advanced_Parameters.md#valuefrompipelinebypropertyname-argument [04]: xref:Microsoft.PowerShell.Utility.Trace-Command diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md index 3503504f87e9..2974f1414e67 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md @@ -8,6 +8,7 @@ title: about_Parameter_Sets # about_Parameter_Sets ## Short description + Describes how to define and use parameter sets in advanced functions. ## Long description @@ -125,9 +126,9 @@ function Measure-Lines { } foreach ($file in $Files) { $result = [ordered]@{ } - $result.Add('File', $file.fullname) + $result.Add('File', $file.FullName) - $content = Get-Content -LiteralPath $file.fullname + $content = Get-Content -LiteralPath $file.FullName if ($Lines) { $result.Add('Lines', $content.Length) } @@ -162,7 +163,7 @@ which parameters can be used in each parameter set. ```powershell (Get-Command Measure-Lines).ParameterSets | - Select-Object -Property @{n='ParameterSetName';e={$_.name}}, + Select-Object -Property @{n='ParameterSetName';e={$_.Name}}, @{n='Parameters';e={$_.ToString()}} ``` @@ -274,4 +275,4 @@ $Var4 = 3 ``` -[01]: about_functions_cmdletbindingattribute.md +[01]: about_Functions_CmdletBindingAttribute.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md index 9703e897277b..74703c94a7c6 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters.md @@ -9,6 +9,7 @@ title: about_Parameters # about_Parameters ## Short description + Describes how to work with command parameters in PowerShell. ## Long description @@ -30,8 +31,8 @@ a value, but do not require the parameter name in the command. The type of parameters and the requirements for those parameters vary. To find information about the parameters of a command, use the `Get-Help` cmdlet. For -example, to find information about the parameters of the `Get-ChildItem` cmdlet, -type: +example, to find information about the parameters of the `Get-ChildItem` +cmdlet, type: ```powershell Get-Help Get-ChildItem @@ -178,8 +179,8 @@ Get-Service -Name $s #### Accepts Pipeline Input -This setting indicates whether you can use the pipeline operator (`|`) to send a -value to the parameter. +This setting indicates whether you can use the pipeline operator (`|`) to send +a value to the parameter. ``` Value Description diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index a41fa093446e..01d5c6f8eb79 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -118,7 +118,7 @@ using an array. This example sets the default value of the ```powershell $PSDefaultParameterValues = @{ - 'Invoke-Command:ComputerName' = 'Server01','Server02' + 'Invoke-Command:ComputerName' = 'Server01', 'Server02' } ``` diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md index babd1811af15..19ca4db57956 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md @@ -128,13 +128,13 @@ uses one of the following syntaxes: literal `@` with `()` starting a new argument that's an expression. - Everything else is treated as an expandable string, except metacharacters - that still need escaping. See [Handling special characters][02]. + that still need escaping. See [Handling special characters][03]. - The argument-mode metacharacters (characters with special syntactic meaning) are: `` ' " ` , ; ( ) { } | & < > @ #``. Of these, `< > @ #` are only special at the start of a token. - The stop-parsing token (`--%`) changes the interpretation of all remaining - arguments. For more information, see the [stop-parsing token][03] section + arguments. For more information, see the [stop-parsing token][04] section below. ### Examples @@ -341,7 +341,7 @@ For more information about the escape requirements, see the documentation for > [!NOTE] > The following examples use the `TestExe.exe` tool. You can build `TestExe` -> from the source code. See [TestExe][05] in the PowerShell source repository. +> from the source code. See [TestExe][06] in the PowerShell source repository. The goal of these examples is to pass the directory path `"C:\Program Files (x86)\Microsoft\"` to a native command so that it received @@ -485,11 +485,11 @@ Cannot access file D:\temp\~\repocache.clixml ## See also -- [about_Command_Syntax][04] +- [about_Command_Syntax][05] [01]: /dotnet/api/system.diagnostics.processstartinfo.arguments -[02]: #handling-special-characters -[03]: #the-stop-parsing-token -[04]: about_Command_Syntax.md -[05]: https://github.com/PowerShell/PowerShell/blob/master/test/tools/TestExe/TestExe.cs +[03]: #handling-special-characters +[04]: #the-stop-parsing-token +[05]: about_Command_Syntax.md +[06]: https://github.com/PowerShell/PowerShell/blob/master/test/tools/TestExe/TestExe.cs diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Pipelines.md index f22d505054e8..d7690715e58c 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -272,8 +272,8 @@ pipeline to display a table of service objects. Get-Service | Format-Table -Property Name, DependentServices ``` -Functionally, this is like using the **InputObject** parameter of `Format-Table` -to submit the object collection. +Functionally, this is like using the **InputObject** parameter of +`Format-Table` to submit the object collection. For example, we can save the collection of services to a variable that's passed using the **InputObject** parameter. @@ -568,9 +568,9 @@ enhances readability. [02]: #investigating-pipeline-errors -[03]: about_command_syntax.md -[04]: about_foreach.md -[05]: about_objects.md -[06]: about_parameters.md +[03]: about_Command_Syntax.md +[04]: about_Foreach.md +[05]: about_Objects.md +[06]: about_Parameters.md [07]: about_Redirection.md [08]: xref:System.Data.DataTable.Rows diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index 15b0c0f3f803..f0f2346e86bb 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -8,6 +8,7 @@ title: about_ANSI_terminals # about_ANSI_Terminals ## Short description + Describes the support available for ANSI escape sequences in PowerShell. ## Long description @@ -229,7 +230,7 @@ in the `bash` process, outside of the PowerShell host, the output isn't affected by **OutputRendering**. ```bash -pwsh -noprofile -command 'Get-Childitem' > out.txt +pwsh -noprofile -command 'Get-ChildItem' > out.txt ``` When you inspect the contents of `out.txt` you see the ANSI escape sequences. @@ -238,7 +239,7 @@ By contrast, when redirection occurs within the PowerShell session, **OutputRendering** affects the redirected output. ```bash -pwsh -noprofile -command 'Get-Childitem > out.txt' +pwsh -noprofile -command 'Get-ChildItem > out.txt' ``` When you inspect the contents of `out.txt` there are no ANSI escape sequences. @@ -252,7 +253,7 @@ The following values of `$env:TERM` change the behavior as follows: - `dumb` - sets `$Host.UI.SupportsVirtualTerminal = $false` - `xterm-mono` - sets `$PSStyle.OutputRendering = PlainText` -- `xtermm` - sets `$PSStyle.OutputRendering = PlainText` +- `xterm` - sets `$PSStyle.OutputRendering = PlainText` If `$env:NO_COLOR` exists, then `$PSStyle.OutputRendering` is set to **PlainText**. For more information about the **NO_COLOR** environment diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Alias_Provider.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Alias_Provider.md index ed2af63eeeef..880a7d095f81 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Alias_Provider.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Alias_Provider.md @@ -40,28 +40,27 @@ The aliases have no child items. The **Alias** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] PowerShell includes a set of cmdlets that are designed to view and to change aliases. When you use **Alias** cmdlets, you do not need to specify the `Alias:` drive in the name. This article does not cover working with **Alias** cmdlets. -- [Export-Alias](xref:Microsoft.PowerShell.Utility.Export-Alias) -- [Get-Alias](xref:Microsoft.PowerShell.Utility.Get-Alias) -- [Import-Alias](xref:Microsoft.PowerShell.Utility.Import-Alias) -- [New-Alias](xref:Microsoft.PowerShell.Utility.New-Alias) -- [Set-Alias](xref:Microsoft.PowerShell.Utility.Set-Alias) +- [Export-Alias][07] +- [Get-Alias][08] +- [Import-Alias][09] +- [New-Alias][10] +- [Set-Alias][11] ## Types exposed by this provider -Each alias is an instance of the -[System.Management.Automation.AliasInfo](/dotnet/api/system.management.automation.aliasinfo) +Each alias is an instance of the [System.Management.Automation.AliasInfo][12] class. ## Navigating the Alias drive @@ -87,11 +86,8 @@ path. > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases on Windows and `dir` -> on Linux and macOS for [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for -> [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` -> is an alias for -> [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> on Linux and macOS for [Get-ChildItem][13], `cd` is an alias for +> [Set-Location][02] and `pwd` is an alias for [Get-Location][01]. ### Displaying the Contents of the Alias: drive @@ -198,7 +194,7 @@ cmdlet. The `-Options` parameter is available in `Set-Item` when you use it with the **Alias** or **Function** provider. ```powershell -Set-Item -Path Alias:dir -Options "AllScope,ReadOnly" +Set-Item -Path Alias:dir -Options "AllScope, ReadOnly" ``` ### Change an aliases referenced command @@ -293,8 +289,8 @@ Determines the value of the **Options** property of an alias. #### Cmdlets supported -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item) +- [New-Item][04] +- [Set-Item][14] ## Using the pipeline @@ -309,10 +305,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system -drive or use the `-Path` parameter of -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system -drive. +[Get-Help][15] command in a file system drive or use the `-Path` parameter of +[Get-Help][15] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -324,5 +318,24 @@ Get-Help Get-ChildItem -Path alias: ## See also -- [about_Aliases](about_Aliases.md) -- [about_Providers](about_Providers.md) +- [about_Aliases][16] +- [about_Providers][17] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: xref:Microsoft.PowerShell.Utility.Export-Alias +[08]: xref:Microsoft.PowerShell.Utility.Get-Alias +[09]: xref:Microsoft.PowerShell.Utility.Import-Alias +[10]: xref:Microsoft.PowerShell.Utility.New-Alias +[11]: xref:Microsoft.PowerShell.Utility.Set-Alias +[12]: /dotnet/api/system.management.automation.aliasinfo +[13]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[14]: xref:Microsoft.PowerShell.Management.Set-Item +[15]: xref:Microsoft.PowerShell.Core.Get-Help +[16]: about_Aliases.md +[17]: about_Providers.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Aliases.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Aliases.md index 250a2d53bf29..dc5c856d3c77 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Aliases.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Aliases.md @@ -129,8 +129,8 @@ in the current session, type: Get-Alias ``` -To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. For -example, to get aliases that begin with "p", type: +To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. +For example, to get aliases that begin with "p", type: ```powershell Get-Alias -Name p* diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md index 738e362b52e7..606cca63b083 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md @@ -9,6 +9,7 @@ title: about_Arithmetic_Operators # about_Arithmetic_Operators ## Short description + Describes the operators that perform arithmetic in PowerShell. ## Long description @@ -202,7 +203,7 @@ result without losing precision. For example: (2 + 3.1).GetType().FullName ``` -```output +```Output 5.1 System.Int32 System.Double @@ -216,7 +217,7 @@ is widened to accommodate the result, as in the following example: (512MB * 512MB).GetType().FullName ``` -```output +```Output System.Int32 System.Double ``` @@ -226,10 +227,10 @@ following example, the negative value can't be cast to an unsigned integer, and the unsigned integer is too large to be cast to `Int32`: ```powershell -([int32]::minvalue + [uint32]::maxvalue).gettype().fullname +([int32]::minvalue + [uint32]::maxvalue).GetType().FullName ``` -```output +```Output System.Int64 ``` @@ -268,8 +269,8 @@ PS> [ulong](9223372036854775807 + 2) 9223372036854775808 ``` -Defining the larger value as `[ulong]` first avoids the problem and produces the -correct result. +Defining the larger value as `[ulong]` first avoids the problem and produces +the correct result. ```powershell PS> 9223372036854775807ul + 2 @@ -326,7 +327,7 @@ $b = "A","B","C" $a + $b ``` -```output +```Output 1 2 3 @@ -389,7 +390,7 @@ $hash2 = @{c1="Server01"; c2="Server02"} $hash1 + $hash2 ``` -```output +```Output Name Value ---- ----- c2 Server02 @@ -408,7 +409,7 @@ $hash2 = @{c1="Server01"; c="Server02"} $hash1 + $hash2 ``` -```output +```Output OperationStopped: Line | 3 | $hash1 + $hash2 @@ -426,7 +427,7 @@ $array2 = $array1 + $hash1 $array2 ``` -```output +```Output 0 Hello World @@ -447,7 +448,7 @@ However, you can't add any other type to a hash table. $hash1 + 2 ``` -```output +```Output InvalidOperation: A hash table can only be added to another hash table. ``` @@ -462,7 +463,7 @@ $array = @() $array ``` -```output +```Output 0 1 2 @@ -507,7 +508,7 @@ results are then added using the `+` operator. Get-Process | Where-Object { ($_.ws * 2) -gt 50mb } ``` -```output +```Output Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 1896 39 50968 30620 264 1,572.55 1104 explorer diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md index 1c58b7a48c4e..5cbe690a6757 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -639,8 +639,8 @@ The value of `mode` must be a [WhereOperatorSelectionMode][02] enum value: - `Default` (`0`) - Return all items - `First` (`1`) - Return the first item - `Last` (`2`) - Return the last item -- `SkipUntil` (`3`) - Skip items until condition is true, return all the remaining - items (including the first item for which the condition is true) +- `SkipUntil` (`3`) - Skip items until condition is true, return all the + remaining items (including the first item for which the condition is true) - `Until` (`4`) - Return all items until condition is true - `Split` (`5`) - Return an array of two elements - The first element contains matching items @@ -1018,8 +1018,8 @@ PS> [Collections.Generic.Dictionary[string, int]]::new()['nosuchkey'] # No output ($null) PS> [Collections.Generic.Dictionary[string, int]]::new().Item('nosuchkey') -GetValueInvocationException: Exception getting "Item": "The given key 'nosuchkey' - was not present in the dictionary." +GetValueInvocationException: Exception getting "Item": "The given key +'nosuchkey' was not present in the dictionary." ``` ## Member-access enumeration diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md index d1363de02103..f8b0822ad313 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md @@ -9,6 +9,7 @@ title: about_Assignment_Operators # about_Assignment_Operators ## Short description + Describes how to use operators to assign values to variables. ## Long description @@ -198,7 +199,7 @@ $a += 2 $a ``` -``` +```Output 6 ``` @@ -645,9 +646,7 @@ $x 100 ``` -For more information, see -[Null-coalescing operator][04]. - +For more information, see [Null-coalescing operator][04]. ## Microsoft .NET types 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 913a7531b682..e181edfe1083 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 @@ -422,7 +422,7 @@ the objects. ```powershell $a = "one", $null, "three" -$a.count +$a.Count ``` ```Output @@ -433,7 +433,7 @@ If you pipe the `$null` variable to the `ForEach-Object` cmdlet, it generates a value for `$null`, just as it does for the other objects ```powershell -"one", $null, "three" | ForEach-Object { "Hello " + $_} +"one", $null, "three" | ForEach-Object {"Hello " + $_} ``` ```Output @@ -451,8 +451,8 @@ were ignored. ```powershell $calendar = @($null, $null, "Meeting", $null, $null, "Team Lunch", $null) -$days = "Sunday","Monday","Tuesday","Wednesday","Thursday", - "Friday","Saturday" +$days = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday" $currentDay = 0 foreach($day in $calendar) { @@ -744,10 +744,9 @@ isn't considered best practice. ### MoveNext -The [MoveNext][76] method -advances the enumerator to the next element of the collection. **MoveNext** -returns `True` if the enumerator was successfully advanced, `False` if the -enumerator has passed the end of the collection. +The [MoveNext][76] method advances the enumerator to the next element of the +collection. **MoveNext** returns `True` if the enumerator was successfully +advanced, `False` if the enumerator has passed the end of the collection. > [!NOTE] > The **Boolean** value returned by **MoveNext** is sent to the output stream. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Booleans.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Booleans.md index 2e7a23403aaf..c8bdd0f281c2 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Booleans.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Booleans.md @@ -9,6 +9,7 @@ title: about_Booleans # about_Booleans ## Short description + Describes how boolean expressions are evaluated. ## Long description diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Break.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Break.md index fa3d26e9ab59..58f643d730e5 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Break.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Break.md @@ -123,7 +123,8 @@ even pass control across script and function call boundaries. ## Using `break` in a `switch` statement -In a `switch`construct, `break` causes PowerShell to exit the `switch` code block. +In a `switch`construct, `break` causes PowerShell to exit the `switch` code +block. The `break` keyword is used to leave the `switch` construct. For example, the following `switch` statement uses `break` statements to test for the most @@ -190,8 +191,8 @@ function test { test ``` -Notice that execution stops at the exception. The `After loop` is never reached. -The exception is re-thrown after the `trap` executes. +Notice that execution stops at the exception. The `After loop` is never +reached. The exception is re-thrown after the `trap` executes. ```Output Before loop diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md index f20588d42002..096a0a40b5f6 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md @@ -69,8 +69,8 @@ This function clears the screen. For more information, see ## `TabExpansion2` -This is the default function to use for tab expansion. For more information, see -[TabExpansion2](xref:Microsoft.PowerShell.Core.TabExpansion2). +This is the default function to use for tab expansion. For more information, +see [TabExpansion2](xref:Microsoft.PowerShell.Core.TabExpansion2). ## `oss` diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md index 2bc88d87cfac..4a9296c8143f 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md @@ -2,6 +2,7 @@ description: Describes how to call generic methods of .NET types in PowerShell Locale: en-US ms.date: 02/02/2022 +online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_calling_generic_methods?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Calling_Generic_Methods --- @@ -9,8 +10,8 @@ title: about_Calling_Generic_Methods Generics let you tailor a method, class, structure, or interface to the precise data type it acts upon. For example, instead of using the - class, which allows keys and values to be -of any type, you can use the +[System.Collections.Hashtable][01] class, which allows keys and values to be +of any type, you can use the [System.Collections.Generic.Dictionary%602][02] generic class and specify the types allowed for the **key** and **value** properties. Generics provide increased code reusability and type safety. @@ -26,8 +27,7 @@ generic method `Empty()` that takes no formal parameters. Prior to PowerShell 7.3, to ensure proper method resolution you had to use complicated workarounds using .NET reflection. For an example, see Lee Holmes' -blog post -[Invoking generic methods on non-generic classes in PowerShell](https://www.leeholmes.com/invoking-generic-methods-on-non-generic-classes-in-powershell/). +blog post [Invoking generic methods on non-generic classes in PowerShell][03]. Beginning with PowerShell 7.3, you can specify the types for a generic method. @@ -53,7 +53,7 @@ types, like `[string, int]`, including other generic types like The `method_arguments` can be zero or more items. -For more information, see [Generics in .NET](/dotnet/standard/generics/). +For more information, see [Generics in .NET][04]. ## Example @@ -88,3 +88,9 @@ The output shows each value raised to the power of 3. 64 125 ``` + + +[01]: xref:System.Collections.Hashtable +[02]: xref:System.Collections.Generic.Dictionary%602 +[03]: https://www.leeholmes.com/invoking-generic-methods-on-non-generic-classes-in-powershell/ +[04]: /dotnet/standard/generics/ diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md index b61dcb04a84e..c75b94c2f28b 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md @@ -9,39 +9,43 @@ title: about_Case-Sensitivity # about_Case-Sensitivity ## Short description + PowerShell is as case-insensitive as possible while preserving case. ## Long description -As a general principle, PowerShell is as case insensitive as possible while preserving case and not -breaking the underlying OS. +As a general principle, PowerShell is as case insensitive as possible while +preserving case and not breaking the underlying OS. ### On Unix-based systems -On Unix-based systems, PowerShell is case-sensitive because filesystem manipulation and environment -variables directly affect the underlying operating system and integration with other tools. +On Unix-based systems, PowerShell is case-sensitive because filesystem +manipulation and environment variables directly affect the underlying +operating system and integration with other tools. ## On all systems - PowerShell variables are case-insensitive - Variable names have no interaction between them and the underlying operating system. PowerShell - treats them case-insensitively. + Variable names have no interaction between them and the underlying operating + system. PowerShell treats them case-insensitively. - Module names are case-insensitive (with exceptions) - The _name_ of the module is purely a PowerShell concept and treated case-insensitively. However, there - is a strong mapping to a foldername, which can be case-sensitive in the underlying operating - system. Importing two modules with the same case-insensitive name has the same behavior as + The _name_ of the module is purely a PowerShell concept and treated + case-insensitively. However, there is a strong mapping to a foldername, which + can be case-sensitive in the underlying operating system. Importing two| + modules with the same case-insensitive name has the same behavior as importing two modules with the same name from different paths. - The name of a module is stored in the session state using the case by which it was imported. The - name, as stored in the session state, is used by `Update-Help` when looking for new help files. - The web service that serves the help files for Microsoft uses a case-sensitive filesystem. When - the case of the imported name of the module doesn't match, `Update-Help` can't find the help files - and reports an error. + The name of a module is stored in the session state using the case by which + it was imported. The name, as stored in the session state, is used + `Update-Help` when looking for new help files. + The web service that serves the help files for Microsoft uses a + case-sensitive filesystem. When the case of the imported name of the module + doesn't match, `Update-Help` can't find the help files and reports an error. ## Related links -- [about_Environment_Variables](about_environment_variables.md) +- [about_Environment_Variables](about_Environment_Variables.md) - [Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Character_Encoding.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Character_Encoding.md index 3c58fbe85f81..5d8441760b75 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Character_Encoding.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Character_Encoding.md @@ -9,6 +9,7 @@ title: about_Character_Encoding # about_Character_Encoding ## Short description + Describes how PowerShell uses character encoding for input and output of string data. @@ -16,8 +17,7 @@ data. Unicode is a worldwide character-encoding standard. The system uses Unicode exclusively for character and string manipulation. For a detailed description -of all aspects of Unicode, refer to -[The Unicode Standard](https://www.unicode.org/standard/standard.html). +of all aspects of Unicode, refer to [The Unicode Standard][01]. Windows supports Unicode and traditional character sets. Traditional character sets, such as Windows code pages, use 8-bit values or combinations of 8-bit @@ -49,8 +49,7 @@ The following cmdlets have the **Encoding** parameter: The byte-order-mark (BOM) is a _Unicode signature_ in the first few bytes of a file or text stream that indicate which Unicode encoding used for the data. For -more information, see the -[Byte order mark](/globalization/encoding/byte-order-mark) documentation. +more information, see the [Byte order mark][02] documentation. In Windows PowerShell, any Unicode encoding, except `UTF7`, always creates a BOM. PowerShell (v6 and higher) defaults to `utf8NoBOM` for all text output. @@ -92,9 +91,9 @@ In PowerShell 5.1, the **Encoding** parameter supports the following values: - `UTF7` Uses UTF-7. - `UTF8` Uses UTF-8 (with BOM). -In general, Windows PowerShell uses the Unicode -[UTF-16LE](https://wikipedia.org/wiki/UTF-16) encoding by default. However, -the default encoding used by cmdlets in Windows PowerShell is not consistent. +In general, Windows PowerShell uses the Unicode [UTF-16LE][03] encoding by +default. However, the default encoding used by cmdlets in Windows PowerShell +is not consistent. > [!NOTE] > Using any Unicode encoding, except `UTF7`, always creates a BOM. @@ -104,7 +103,7 @@ For cmdlets that write output to files: - `Out-File` and the redirection operators `>` and `>>` create UTF-16LE, which notably differs from `Set-Content` and `Add-Content`. -- `New-ModuleManifest` and `Export-CliXml` also create UTF-16LE files. +- `New-ModuleManifest` and `Export-Clixml` also create UTF-16LE files. - When the target file is empty or doesn't exist, `Set-Content` and `Add-Content` use `Default` encoding. `Default` is the encoding specified by @@ -149,7 +148,7 @@ For cmdlets that read string data in the absence of a BOM: encoding. ANSI is also what the PowerShell engine uses when it reads source code from files. -- `Import-Csv`, `Import-CliXml`, and `Select-String` assume `Utf8` in the +- `Import-Csv`, `Import-Clixml`, and `Select-String` assume `Utf8` in the absence of a BOM. ## Character encoding in PowerShell @@ -175,10 +174,9 @@ PowerShell defaults to `utf8NoBOM` for all output. Beginning with PowerShell 6.2, the **Encoding** parameter also allows numeric IDs of registered code pages (like `-Encoding 1251`) or string names of registered code pages (like `-Encoding "windows-1251"`). For more information, -see the .NET documentation for -[Encoding.CodePage](/dotnet/api/system.text.encoding.codepage). +see the .NET documentation for [Encoding.CodePage][04]. -Starting with PowerShell 7.4, you can use the `Ansi` value for the **Encoding** +Starting with PowerShell 7.4, you can use the `ANSI` value for the **Encoding** parameter to pass the numeric ID for the current culture's ANSI code page without having to specify it manually. @@ -190,8 +188,7 @@ encoding behavior. - `$PSDefaultParameterValues` - `$OutputEncoding` -For more information, see -[about_Preference_Variables](about_Preference_Variables.md). +For more information, see [about_Preference_Variables][05]. Beginning in PowerShell 5.1, the redirection operators (`>` and `>>`) call the `Out-File` cmdlet. Therefore, you can set the default encoding of them using @@ -224,10 +221,17 @@ the output redirection operators and PowerShell cmdlets use to save to files. ## See also -- [about_Preference_Variables](about_Preference_Variables.md) +- [about_Preference_Variables][05] - [Byte order mark](https://wikipedia.org/wiki/Byte_order_mark) - [Code Pages - Win32 apps](/windows/win32/intl/code-pages) -- [Encoding.CodePage](/dotnet/api/system.text.encoding.codepage) +- [Encoding.CodePage][04] - [Introduction to character encoding in .NET](/dotnet/standard/base-types/character-encoding-introduction) -- [The Unicode Standard](https://www.unicode.org/standard/standard.html) -- [UTF-16LE](https://wikipedia.org/wiki/UTF-16) +- [The Unicode Standard][01] +- [UTF-16LE][03] + + +[01]: https://www.unicode.org/standard/standard.html +[02]: /globalization/encoding/byte-order-mark +[03]: https://wikipedia.org/wiki/UTF-16 +[04]: /dotnet/api/system.text.encoding.codepage +[05]: about_Preference_Variables.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_CimSession.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_CimSession.md index 3d4de8d49269..f93a341dbdeb 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_CimSession.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_CimSession.md @@ -9,6 +9,7 @@ title: about_CimSession # about_CimSession ## Short description + Describes a **CimSession** object and the difference between CIM sessions and PowerShell sessions. @@ -35,7 +36,7 @@ If you create a **PSSession** instead of using a CIM session, PowerShell validates connection settings, and then establishes and maintains the connection. If you use CIM sessions, PowerShell does not open a network connection until needed. For more information about PowerShell sessions, see -[about_PSSessions](about_PSSessions.md). +[about_PSSessions][01]. ## When to use a CIM session @@ -56,7 +57,7 @@ Management (WinRM). CIM sessions do not impose the WinRM limits. CIM-based Cmdlet Definition XML (CDXML) cmdlets can be written to use any WMI Provider. All WMI providers use **CimSession** objects. For more information -about CDXML, see [CDXML definition and terms](/previous-versions/windows/desktop/wmi_v2/cdxml-overview). +about CDXML, see [CDXML definition and terms][02]. CDXML cmdlets have an automatic **CimSession** parameter that can take an array of **CimSession** objects. By default, PowerShell limits number of concurrent @@ -66,5 +67,10 @@ understand the **ThrottleLimit**. ## See also -- [about_PSSessions](about_PSSessions.md) -- [New-CimSession](xref:CimCmdlets.New-CimSession) +- [about_PSSessions][01] +- [New-CimSession][03] + + +[01]: about_PSSessions.md +[02]: /previous-versions/windows/desktop/wmi_v2/cdxml-overview +[03]: xref:CimCmdlets.New-CimSession diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes.md index 8243d0f3757d..a9dafcf7db6a 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes.md @@ -9,6 +9,7 @@ title: about_Classes # about_Classes ## Short description + Describes how you can use classes to create your own custom types. ## Long description diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md index d2bf5f880e16..3f5556cc6c0a 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md @@ -18,8 +18,8 @@ Describes how you can define classes that extend other types. PowerShell classes support _inheritance_, which allows you to define a child class that reuses (inherits), extends, or modifies the behavior of a parent class. The class whose members are inherited is called the _base class_. The -class that inherits the members of the base class is called the _derived -class_. +class that inherits the members of the base class is called the +_derived class_. PowerShell supports single inheritance only. A class can only inherit from a single class. However, inheritance is transitive, which allows you to define an @@ -1496,8 +1496,8 @@ the value of an inherited static property in a class that doesn't override the property might have unintended effects for classes derived from the same base class. -[Example 1][05] shows how -derived classes that inherit, extend, and override the base class properties. +[Example 1][05] shows how derived classes that inherit, extend, and override +the base class properties. ### Deriving from generics diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Methods.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Methods.md index d886be3108d0..a0344e6a9ea6 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Methods.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Methods.md @@ -800,7 +800,7 @@ PowerShell class methods have the following limitations: [01]: about_Preference_Variables.md [02]: #hidden-methods [03]: #static-methods -[04]: about_functions_advanced_parameters.md#parameter-and-variable-validation-attributes +[04]: about_Functions_Advanced_Parameters.md#parameter-and-variable-validation-attributes [05]: #example-4---static-method-with-overloads [06]: #defining-instance-methods-with-update-typedata [07]: about_Automatic_Variables.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Properties.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Properties.md index 183de93b5aae..611c01f846d3 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Properties.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Classes_Properties.md @@ -953,7 +953,7 @@ PowerShell class properties have the following limitations: [06]: /dotnet/csharp/language-reference/builtin-types/default-values [07]: about_Hidden.md [08]: about_Classes_Inheritance.md -[09]: about_functions_advanced_parameters.md#parameter-and-variable-validation-attributes +[09]: about_Functions_Advanced_Parameters.md#parameter-and-variable-validation-attributes [10]: about_Classes.md [11]: about_Classes_Constructors.md [12]: about_Classes_Inheritance.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md index be2c67b5481c..f3ae0da2d07f 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md @@ -9,6 +9,7 @@ title: about_Command_Syntax # about_Command_Syntax ## Short description + Describes the syntax diagrams that are used in PowerShell. ## Long description @@ -165,7 +166,7 @@ The syntax diagrams use the following symbols: The placeholder inside the angle brackets identifies the .NET type of the value that a parameter takes. For example, to use the **Name** parameter of - the `Get-Command ` cmdlet, you replace the `` with one or more + the `Get-Command` cmdlet, you replace the `` with one or more strings separated by commas (`,`). diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md index 6ba018dee95f..63a9b5718b8d 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md @@ -171,7 +171,7 @@ function Get-Function { } The following are valid comment-based help keywords. These keywords can appear in any order in the comment-based help, and they aren't case-sensitive. The -keywords are listed in in this article inthe order that they typically appear +keywords are listed in this article in the order that they typically appear in a help topic. ### .SYNOPSIS diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_CommonParameters.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_CommonParameters.md index cdd807ef7e04..776abbac7231 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_CommonParameters.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_CommonParameters.md @@ -173,8 +173,8 @@ By default, new error messages overwrite error messages that are already stored in the variable. To append the error message to the variable content, put a plus sign (`+`) before the variable name. -For example, the following command creates the `$a` variable and then stores any -errors in it: +For example, the following command creates the `$a` variable and then stores +any errors in it: ```powershell Get-Process -Id 6 -ErrorVariable a @@ -759,7 +759,7 @@ Mode LastWriteTime Length Name [02]: about_Automatic_Variables.md [03]: about_Preference_Variables.md -[05]: about_functions_advanced.md +[05]: about_Functions_Advanced.md [06]: xref:Microsoft.PowerShell.Utility.Write-Progress [07]: xref:System.Management.Automation.ActionPreference [11]: xref:Microsoft.PowerShell.Utility.Write-Debug diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index b77a671fa161..1f4d09a5e40f 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -680,8 +680,8 @@ Examples: More complex examples: ```powershell -$DomainServers = "ContosoDC1","ContosoDC2","ContosoFileServer","ContosoDNS", - "ContosoDHCP","ContosoWSUS" +$DomainServers = "ContosoDC1", "ContosoDC2", "ContosoFileServer", + "ContosoDNS", "ContosoDHCP", "ContosoWSUS" $thisComputer = "ContosoDC2" $DomainServers -contains $thisComputer @@ -731,8 +731,8 @@ The following examples do the same thing that the examples for `-contains` and More complex examples: ```powershell -$DomainServers = "ContosoDC1","ContosoDC2","ContosoFileServer","ContosoDNS", - "ContosoDHCP","ContosoWSUS" +$DomainServers = "ContosoDC1", "ContosoDC2", "ContosoFileServer", + "ContosoDNS", "ContosoDHCP", "ContosoWSUS" $thisComputer = "ContosoDC2" $thisComputer -in $DomainServers diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Continue.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Continue.md index 4349b15dc4c1..3ae9ef8e5cc0 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Continue.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Continue.md @@ -88,13 +88,13 @@ is **True** and iteration continues with the second `for` loop at `labelB`. ## Using continue in a switch statement An unlabeled `continue` statement within a `switch` terminates execution of the -current `switch` iteration and transfers control to the top of the `switch` to get -the next input item. +current `switch` iteration and transfers control to the top of the `switch` to +get the next input item. -When there is a single input item `continue` exits the entire `switch` statement. -When the `switch` input is a collection, the `switch` tests each element of the -collection. The `continue` exits the current iteration and the `switch` continues -with the next element. +When there is a single input item `continue` exits the entire `switch` +statement. When the `switch` input is a collection, the `switch` tests each +element of the collection. The `continue` exits the current iteration and the +`switch` continues with the next element. ```powershell switch (1,2,3) { diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Core_Commands.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Core_Commands.md index 0c9063e215c0..8dbfdce18d92 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Core_Commands.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Core_Commands.md @@ -9,6 +9,7 @@ title: about_Core_Commands # about_Core_Commands ## Short description + Lists the cmdlets that are designed for use with PowerShell providers. ## Long description diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Files.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Files.md index e43fe2a6ca6f..a2801fc84252 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Files.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Files.md @@ -9,6 +9,7 @@ title: about_Data_Files # about_Data_Files ## Short description + PowerShell data files are used to store arbitrary data using PowerShell syntax. ## Long description @@ -47,10 +48,10 @@ the commands and variables that can be used. For more information, see [about_Language_Modes][02]. -Originally, localized data files were meant to be used to store string data that -could be translated into other languages. This allowed your scripts to import -the data to provide localized string output in other languages. However, you -aren't limited to storing string data and don't have to use the data for +Originally, localized data files were meant to be used to store string data +that could be translated into other languages. This allowed your scripts to +import the data to provide localized string output in other languages. However, +you aren't limited to storing string data and don't have to use the data for localized output. The data in the file isn't limited to hashtables. It can be in any format diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Sections.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Sections.md index 674b62cb835e..b8781e3e0028 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Sections.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Data_Sections.md @@ -98,8 +98,8 @@ DATA -supportedCommand Format-Xml ### Using a `DATA` Section -To use the content of a `DATA` section, assign it to a variable and use variable -notation to access the content. +To use the content of a `DATA` section, assign it to a variable and use +variable notation to access the content. For example, the following `DATA` section contains a `ConvertFrom-StringData` command that converts the here-string into a hash table. The hash table is @@ -173,7 +173,7 @@ A single-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell DATA { - ConvertFrom-StringData -stringdata @' + ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 '@ @@ -184,7 +184,7 @@ A double-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell DATA { - ConvertFrom-StringData -stringdata @" + ConvertFrom-StringData -StringData @" Msg1 = To start, press any key. Msg2 = To exit, type "quit". "@ @@ -195,7 +195,7 @@ A data section that includes a user-written cmdlet that generates data: ```powershell DATA -supportedCommand Format-XML { - Format-Xml -strings string1, string2, string3 + Format-Xml -Strings string1, string2, string3 } ``` diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Debuggers.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Debuggers.md index f12678843304..338b8af7d3e0 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Debuggers.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Debuggers.md @@ -192,7 +192,7 @@ For example, the following command gets the variables in the local (script) scope: ```powershell -Get-Variable -scope 0 +Get-Variable -Scope 0 ``` This is a useful way to see only the variables that you defined in the script @@ -225,17 +225,17 @@ For example: ```powershell function test-cmdlet { begin { - write-output "Begin" + Write-Output "Begin" } process { - write-output "Process" + Write-Output "Process" } end { - write-output "End" + Write-Output "End" } } -C:\PS> Set-PSBreakpoint -command test-cmdlet +C:\PS> Set-PSBreakpoint -Command test-cmdlet C:\PS> test-cmdlet @@ -285,7 +285,7 @@ identifying changes to the prompt: ```powershell Enter-PSSession -Cn localhost -[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6,11,22,25 +[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6, 11, 22, 25 ID Script Line Command Variable Action -- ------ ---- ------- -------- ------ @@ -367,7 +367,7 @@ Start by creating a line breakpoint on the first line of the Test.ps1 script in the current directory. ```powershell -PS C:\ps-test> Set-PSBreakpoint -line 1 -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Line 1 -Script test.ps1 ``` The command returns a **System.Management.Automation.LineBreakpoint** object. @@ -482,7 +482,7 @@ reuse the breakpoint, use the `Disable-PsBreakpoint` cmdlet instead of `Remove-PsBreakpoint`.) ```powershell -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint ``` You can abbreviate this command as: @@ -501,13 +501,13 @@ function delbr { gbp | rbp } Now, create a breakpoint on the `$scriptname` variable. ```powershell -PS C:\ps-test> Set-PSBreakpoint -variable scriptname -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Variable scriptname -Script test.ps1 ``` You can abbreviate the command as: ```powershell -PS C:\ps-test> sbp -v scriptname -s test.ps1 +PS C:\ps-test> sbp -V scriptname -S test.ps1 ``` Now, start the script. The script reaches the variable breakpoint. The default @@ -557,8 +557,8 @@ Have you run a background job today (start-job)? test.ps1:13 "Done $scriptName" ``` -The `StepOver` command executes the function, and it previews the next statement -in the script, which prints the final line. +The `StepOver` command executes the function, and it previews the next +statement in the script, which prints the final line. Use a `Stop` command (`t`) to exit the debugger. The command prompt reverts to the standard command prompt. @@ -571,19 +571,19 @@ To delete the breakpoints, use the `Get-PsBreakpoint` and `Remove-PsBreakpoint` cmdlets. ```powershell -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint ``` Create a new command breakpoint on the `psversion` function. ```powershell -PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 ``` You can abbreviate this command to: ```powershell -PS C:\ps-test> sbp -c psversion -s test.ps1 +PS C:\ps-test> sbp -C psversion -S test.ps1 ``` Now, run the script. @@ -612,7 +612,7 @@ Windows PowerShell 2.0 Have you run a background job today (start-job)? Done C:\ps-test\test.ps1 -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint PS C:\ps-test> ``` @@ -623,9 +623,9 @@ the action, execution doesn't stop. The backtick (`` ` ``) is the line-continuation character. ```powershell -PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 ` --action { add-content "The value of `$scriptName is $scriptName." ` --path action.log} +PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 ` +-Action { Add-Content "The value of `$scriptName is $scriptName." ` +-Path action.log} ``` You can also add actions that set conditions for the breakpoint. In the @@ -634,8 +634,8 @@ policy is set to RemoteSigned, the most restrictive policy that still permits you to run scripts. ```powershell -PS C:\ps-test> Set-PSBreakpoint -script test.ps1 -command psversion ` --action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }} +PS C:\ps-test> Set-PSBreakpoint -Script test.ps1 -Command psversion ` +-Action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }} ``` The `break` keyword in the action directs the debugger to execute the @@ -700,7 +700,7 @@ features that you can use to debug scripts and functions. [01]: /powershell/scripting/dev-cross-plat/vscode/using-vscode#debugging-with-visual-studio-code -[02]: about_prompts.md +[02]: about_Prompts.md [05]: xref:Microsoft.PowerShell.Utility.Disable-PSBreakpoint [06]: xref:Microsoft.PowerShell.Utility.Enable-PSBreakpoint [07]: xref:Microsoft.PowerShell.Utility.Get-PSBreakpoint diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Do.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Do.md index c31ebb95209d..e5c9c41b4d21 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Do.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Do.md @@ -9,6 +9,7 @@ title: about_Do # about_Do ## Short description + Runs a statement list one or more times, subject to a `While` or `Until` condition. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Provider.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Provider.md index 414d4e288126..c36ad1925398 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Provider.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Provider.md @@ -9,6 +9,7 @@ title: about_Environment_Provider # about_Environment_Provider ## Provider name + Environment ## Drives @@ -25,8 +26,8 @@ Provides access to the Windows environment variables. ## Detailed description -The PowerShell **Environment** provider lets you get, add, change, clear, and delete environment -variables and values in PowerShell. +The PowerShell **Environment** provider lets you get, add, change, clear, and +delete environment variables and values in PowerShell. **Environment** variables are dynamically named variables that describe the environment in which your programs run. Windows and PowerShell use environment @@ -41,19 +42,18 @@ have no child items. The **Environment** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] ## Types exposed by this provider Each environment variable is an instance of the -[System.Collections.DictionaryEntry](/dotnet/api/system.collections.dictionaryentry) -class. The name of the variable is the dictionary key. The value of the -environment variable is the dictionary value. +[System.Collections.DictionaryEntry][07] class. The name of the variable is the +dictionary key. The value of the environment variable is the dictionary value. ## Navigating the Environment drive @@ -74,10 +74,11 @@ Set-Location C: ``` You can also work with the **Environment** provider from any other PowerShell -drive. To reference an environment variable from another location, use the drive name `Env:` in the path. +drive. To reference an environment variable from another location, use the +drive name `Env:` in the path. -The **Environment** provider also exposes environment variables using a variable -prefix of `$env:`. The following command views the contents of the +The **Environment** provider also exposes environment variables using a +variable prefix of `$env:`. The following command views the contents of the **ProgramFiles** environment variable. The `$env:` variable prefix can be used from any PowerShell drive. @@ -93,9 +94,8 @@ session for as long as it is active. > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is -> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][08], `cd` is an alias for [Set-Location][02] and `pwd` is +> an alias for [Get-Location][01]. ## Getting environment variables @@ -202,8 +202,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path` -parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive. +[Get-Help][09] command in a file system drive or use the `-Path` parameter of +[Get-Help][09] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -215,4 +215,16 @@ Get-Help Get-ChildItem -Path env: ## See also -- [about_Providers](about_Providers.md) +- [about_Providers][10] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: /dotnet/api/system.collections.dictionaryentry +[08]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[09]: xref:Microsoft.PowerShell.Core.Get-Help +[10]: about_Providers.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 8e464c4d89ce..0a325b836ca2 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -9,6 +9,7 @@ title: about_Environment_Variables # about_Environment_Variables ## Short description + Describes how to access and manage environment variables in PowerShell. Environment variables store data that's used by the operating system and other @@ -541,7 +542,7 @@ or `NO_COLOR` environment variables. - `dumb` - sets `$Host.UI.SupportsVirtualTerminal = $false` - `xterm-mono` - sets `$PSStyle.OutputRendering = PlainText` - - `xtermm` - sets `$PSStyle.OutputRendering = PlainText` + - `xterm` - sets `$PSStyle.OutputRendering = PlainText` - `NO_COLOR` @@ -562,12 +563,12 @@ or `NO_COLOR` environment variables. [03]: #powershell-environment-variables [04]: about_Environment_Provider.md [05]: about_Execution_Policies.md -[06]: about_preference_variables.md -[07]: about_profiles.md +[06]: about_Preference_Variables.md +[07]: about_Profiles.md [08]: about_PSModulePath.md [09]: about_Telemetry.md [10]: about_Update_Notifications.md -[11]: about_variables.md +[11]: about_Variables.md [12]: https://no-color.org/ [13]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html [14]: xref:PowerShellGet.Install-Module diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Execution_Policies.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Execution_Policies.md index 49f96c1ba1cb..3a34634617a2 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Execution_Policies.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Execution_Policies.md @@ -87,9 +87,9 @@ execution policies are as follows: - The default execution policy for Windows client computers. - Permits individual commands, but does not allow scripts. - - Prevents running of all script files, including formatting and configuration - files (`.ps1xml`), module script files (`.psm1`), and PowerShell profiles - (`.ps1`). + - Prevents running of all script files, including formatting and + configuration files (`.ps1xml`), module script files (`.psm1`), and + PowerShell profiles (`.ps1`). - `Undefined` @@ -137,8 +137,8 @@ execution policies are as follows: The **Process** scope only affects the current PowerShell session. The execution policy is saved in the environment variable - `$env:PSExecutionPolicyPreference`, rather than the configuration file. When the - PowerShell session is closed, the variable and value are deleted. + `$env:PSExecutionPolicyPreference`, rather than the configuration file. When + the PowerShell session is closed, the variable and value are deleted. - CurrentUser @@ -201,12 +201,12 @@ To change the PowerShell execution policy on your Windows computer, use the need to restart PowerShell. If you set the execution policy for the scopes **LocalMachine** or the -**CurrentUser**, the change is saved in the configuration file and remains effective -until you change it again. +**CurrentUser**, the change is saved in the configuration file and remains +effective until you change it again. If you set the execution policy for the **Process** scope, it's not saved in -the configuration file. The execution policy is retained until the current process and -any child processes are closed. +the configuration file. The execution policy is retained until the current +process and any child processes are closed. > [!NOTE] > In Windows Vista and later versions of Windows, to run commands that @@ -280,15 +280,15 @@ For example: pwsh.exe -ExecutionPolicy AllSigned ``` -The execution policy that you set isn't stored in the configuration file. Instead, it's -stored in the `$env:PSExecutionPolicyPreference` environment variable. The -variable is deleted when you close the session in which the policy is set. You -cannot change the policy by editing the variable value. +The execution policy that you set isn't stored in the configuration file. +Instead, it's stored in the `$env:PSExecutionPolicyPreference` environment +variable. The variable is deleted when you close the session in which the +policy is set. You cannot change the policy by editing the variable value. During the session, the execution policy that is set for the session takes -precedence over an execution policy that is set in the configuration file for the local -computer or current user. However, it doesn't take precedence over the -execution policy set by using a Group Policy. +precedence over an execution policy that is set in the configuration file for +the local computer or current user. However, it doesn't take precedence over +the execution policy set by using a Group Policy. ## Use Group Policy to Manage Execution Policy @@ -359,8 +359,7 @@ Beginning in PowerShell 3.0, you can use the **Stream** parameter of the from the internet. Use the `Unblock-File` cmdlet to unblock the scripts so that you can run them in PowerShell. -For more information, see [about_Signing][04], -[Get-Item][05], and +For more information, see [about_Signing][04], [Get-Item][05], and [Unblock-File][08]. > [!NOTE] @@ -411,7 +410,7 @@ Zone check which avoids the problem. [01]: about_Environment_Variables.md [02]: about_Group_Policy_Settings.md -[03]: about_pwsh.md +[03]: about_Pwsh.md [04]: about_Signing.md [05]: xref:Microsoft.PowerShell.Management.Get-Item [06]: xref:Microsoft.PowerShell.Security.Get-ExecutionPolicy diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Experimental_Features.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Experimental_Features.md index b06a1775ec46..3eb782e5aeca 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Experimental_Features.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Experimental_Features.md @@ -125,8 +125,8 @@ public class InvokeWebRequestCommandV2 : WebCmdletBaseV2 { ... } public class InvokeWebRequestCommand : WebCmdletBase { ... } ``` -When the `MyWebCmdlets.PSWebCmdletV2` experimental feature is enabled, the existing -`InvokeWebRequestCommand` implementation is hidden and the +When the `MyWebCmdlets.PSWebCmdletV2` experimental feature is enabled, the +existing `InvokeWebRequestCommand` implementation is hidden and the `InvokeWebRequestCommandV2` provides the implementation of `Invoke-WebRequest`. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md index bc9c81d4fb56..af99028ec811 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md @@ -547,9 +547,10 @@ non-hidden items. The **Hidden** parameter was introduced in Windows PowerShell 3.0. -To get only hidden items, use the **Hidden** parameter, its `h` or `ah` aliases, -or the **Hidden** value of the **Attributes** parameter. To exclude hidden -items, omit the **Hidden** parameter or use the **Attributes** parameter. +To get only hidden items, use the **Hidden** parameter, its `h` or `ah` +aliases, or the **Hidden** value of the **Attributes** parameter. To exclude +hidden items, omit the **Hidden** parameter or use the **Attributes** +parameter. #### Cmdlets supported @@ -681,7 +682,7 @@ Get-Help Get-ChildItem -Path c: - [about_Providers][08] - + [01]: /dotnet/api/system.datetime [02]: /dotnet/api/system.io.directoryinfo [03]: /dotnet/api/system.io.fileattributes diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_For.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_For.md index 5aa6d3c2a02a..850c807c788f 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_For.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_For.md @@ -9,6 +9,7 @@ title: about_For # about_For ## Short description + Describes a language command you can use to run statements based on a conditional test. @@ -117,7 +118,7 @@ for (($i = 0), ($j = 0); $i -lt 10 -and $j -lt 10; $i++,$j++) } ``` -For more information, see [about_Logical_Operators](about_Logical_Operators.md). +For more information, see [about_Logical_Operators][01]. ### Syntax examples @@ -224,7 +225,7 @@ for ($i = 0; $i -le 20; $i += 2) The `For` loop can also be written on one line as in the following example. ```powershell -for ($i = 0; $i -lt 10; $i++) { Write-Host $i } +for ($i = 0; $i -lt 10; $i++){Write-Host $i} ``` ### Functional example @@ -355,7 +356,7 @@ properties: index. ```powershell -$paddedList = Get-ChildItem -path ./work_items +$paddedList = Get-ChildItem -Path ./work_items # Sort both file lists by name. $sortedOriginal = $fileList | Sort-Object -Property Name @@ -405,5 +406,10 @@ In the output, the sorted work items after padding are in the expected order. ## See also -- [about_Comparison_Operators](about_Comparison_Operators.md) -- [about_Foreach](about_Foreach.md) +- [about_Comparison_Operators][02] +- [about_Foreach][03] + + +[01]: about_Logical_Operators.md +[02]: about_Comparison_Operators.md +[03]: about_Foreach.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Foreach.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Foreach.md index 4a2d10b3758d..e64014b82ed3 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Foreach.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Foreach.md @@ -9,6 +9,7 @@ title: about_Foreach # about_Foreach ## Short description + Describes a language command you can use to traverse all the items in a collection of items. @@ -104,8 +105,8 @@ counts files over 100 KB in size: ```powershell $i = 0 foreach ($file in Get-ChildItem) { - if ($file.length -gt 100KB) { - Write-Host $file 'file size:' ($file.length / 1024).ToString('F0') KB + if ($file.Length -gt 100KB) { + Write-Host $file 'file size:' ($file.Length / 1024).ToString('F0') KB $i = $i + 1 } } @@ -127,7 +128,7 @@ display a count of files over 100KB. The previous example also demonstrates how to format the file length results: ```powershell -($file.length / 1024).ToString('F0') +($file.Length / 1024).ToString('F0') ``` The value is divided by 1,024 to show the results in kilobytes rather than diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index 5102992f8c42..e97ce7fd840b 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -65,10 +65,9 @@ new objects, create your own `Format.ps1xml` files, and then add them to your PowerShell session. To create a `Format.ps1xml` file to define a custom view, use the -[Get-FormatData](xref:Microsoft.PowerShell.Utility.Get-FormatData) and -[Export-FormatData](xref:Microsoft.PowerShell.Utility.Export-FormatData) -cmdlets. Use a text editor to edit the file. The file can be saved to any -directory that PowerShell can access, such as a subdirectory of `$HOME`. +[Get-FormatData][01] and [Export-FormatData][02] cmdlets. Use a text editor to +edit the file. The file can be saved to any directory that PowerShell can +access, such as a subdirectory of `$HOME`. To change the formatting of a current view, locate the view in the formatting file, and then use the tags to change the view. To create a view for a new @@ -76,13 +75,12 @@ object type, create a new view, or use an existing view as a model. The tags are described in the next section. You can then delete all the other views in the file so that the changes are obvious to anyone examining the file. -After you save the changes, use the -[Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData) to -add the new file to your PowerShell session. If you want your view to take -precedence over a view defined in the built-in files, use the **PrependPath** -parameter. `Update-FormatData` affects only the current session. To make the -change to all future sessions, add the `Update-FormatData` command to your -PowerShell profile. +After you save the changes, use the [Update-FormatData][03] to add the new file +to your PowerShell session. If you want your view to take precedence over a +view defined in the built-in files, use the **PrependPath** parameter. +`Update-FormatData` affects only the current session. To make the change to +all future sessions, add the `Update-FormatData` command to your PowerShell +profile. ### Example: Add calendar data to culture objects @@ -193,7 +191,7 @@ the current PowerShell session. This example uses the **PrependPath** parameter to place the new file in a higher precedence order than the original file. For more information, see -[Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData). +[Update-FormatData][03]. ```powershell Update-FormatData -PrependPath $HOME\Format\CultureInfo.Format.ps1xml @@ -214,8 +212,8 @@ LCID Name Calendar DisplayName ## The XML in Format.ps1xml files -The full schema definition can be found in [Format.xsd](https://github.com/PowerShell/PowerShell/blob/master/src/Schemas/Format.xsd) -in the PowerShell source code repository on GitHub. +The full schema definition can be found in [Format.xsd][04] in the PowerShell +source code repository on GitHub. The **ViewDefinitions** section of each `Format.ps1xml` file contains the `` tags that define each view. A typical `` tag includes the @@ -284,9 +282,9 @@ The `` tag typically contains a `` tag. The contains one `` tag. A `` tag must include either a `` tag or a -`` tag. A `` tag specifies the property to display at -the specified location in the view. A `` tag specifies a script to -evaluate and display at the specified location in the view. +`` tag. A `` tag specifies the property to display +at the specified location in the view. A `` tag specifies a script +to evaluate and display at the specified location in the view. A `` tag can contain a `` tag that specifies how to display the property. @@ -309,15 +307,12 @@ value of the **Name** parameter: - FormatFileLoading - FormatViewBinding -For more information, see -[Trace-Command](xref:Microsoft.PowerShell.Utility.Trace-Command) and -[Get-TraceSource](xref:Microsoft.PowerShell.Utility.Get-TraceSource). +For more information, see [Trace-Command][05] and [Get-TraceSource][06]. ## Signing a Format.ps1xml file To protect the users of your `Format.ps1xml` file, sign the file using a -digital signature. For more information, see -[about_Signing](about_Signing.md). +digital signature. For more information, see [about_Signing][07]. ## Sample XML for a Format-Table custom view @@ -341,8 +336,7 @@ For this example, the custom view must use the table format, otherwise, Use `Format-Table` with the **View** parameter to specify the custom view's name, **mygciview**, and format the table's output with the **CreationTime** -column. For an example of how the command is run, see -[Format-Table](xref:Microsoft.PowerShell.Utility.Format-Table). +column. For an example of how the command is run, see [Format-Table][08]. > [!NOTE] > Although you can get the formatting XML from the source code to create a @@ -429,10 +423,22 @@ Update-FormatData -AppendPath ./Mygciview.Format.ps1xml ## See also -- [Trace-Command](xref:Microsoft.PowerShell.Utility.Trace-Command) -- [Export-FormatData](xref:Microsoft.PowerShell.Utility.Export-FormatData) -- [Get-FormatData](xref:Microsoft.PowerShell.Utility.Get-FormatData) -- [Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData) -- [Get-TraceSource](xref:Microsoft.PowerShell.Utility.Get-TraceSource) -- [Format Schema XML Reference](/powershell/scripting/developer/format/format-schema-xml-reference) -- [Writing a PowerShell Formatting File](/powershell/scripting/developer/format/writing-a-powershell-formatting-file) +- [Trace-Command][05] +- [Export-FormatData][02] +- [Get-FormatData][01] +- [Update-FormatData][03] +- [Get-TraceSource][06] +- [Format Schema XML Reference][09] +- [Writing a PowerShell Formatting File][10] + + +[01]: xref:Microsoft.PowerShell.Utility.Get-FormatData +[02]: xref:Microsoft.PowerShell.Utility.Export-FormatData +[03]: xref:Microsoft.PowerShell.Utility.Update-FormatData +[04]: https://github.com/PowerShell/PowerShell/blob/master/src/Schemas/Format.xsd +[05]: xref:Microsoft.PowerShell.Utility.Trace-Command +[06]: xref:Microsoft.PowerShell.Utility.Get-TraceSource +[07]: about_Signing.md +[08]: xref:Microsoft.PowerShell.Utility.Format-Table +[09]: /powershell/scripting/developer/format/format-schema-xml-reference +[10]: /powershell/scripting/developer/format/writing-a-powershell-formatting-file diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Function_Provider.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Function_Provider.md index 8af89066bad7..ee9594e1c5e1 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Function_Provider.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Function_Provider.md @@ -9,6 +9,7 @@ title: about_Function_Provider # about_Function_Provider ## Provider name + Function ## Drives @@ -39,20 +40,18 @@ and filter objects. Neither functions nor filters have child items. The **Function** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] ## Types exposed by this provider Each function is an instance of the -[System.Management.Automation.FunctionInfo](/dotnet/api/system.management.automation.functioninfo) -class. Each filter is an instance of the -[System.Management.Automation.FilterInfo](/dotnet/api/system.management.automation.filterinfo) -class. +[System.Management.Automation.FunctionInfo][07] class. Each filter is an +instance of the [System.Management.Automation.FilterInfo][08] class. ## Navigating the Function drive @@ -79,9 +78,8 @@ drive. To reference a function from another location, use the drive name > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is -> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][09], `cd` is an alias for [Set-Location][10] and `pwd` is +> an alias for [Get-Location][01]. ## Getting functions @@ -125,11 +123,11 @@ ${function:Clear-Host} This command gets the `man` function from the `Function:` drive. It uses the `Get-Item` cmdlet to get the function. The pipeline operator (`|`) sends the result to `Format-Table`. The `-Wrap` parameter directs text that does not fit -on the line onto the next line. The `-Autosize` parameter resizes the table +on the line onto the next line. The `-AutoSize` parameter resizes the table columns to accommodate the text. ```powershell -Get-Item -Path man | Format-Table -Wrap -Autosize +Get-Item -Path man | Format-Table -Wrap -AutoSize ``` ### Working with Function provider paths @@ -222,9 +220,9 @@ Determines the value of the **Options** property of a function. ### Cmdlets supported -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) +- [New-Item][04] -- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item) +- [Set-Item][11] ## Using the pipeline @@ -239,8 +237,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path` -parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive. +[Get-Help][12] command in a file system drive or use the `-Path` parameter of +[Get-Help][12] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -252,5 +250,21 @@ Get-Help Get-ChildItem -Path function: ## See also -- [about_Functions](about_Functions.md) -- [about_Providers](about_Providers.md) +- [about_Functions][13] +- [about_Providers][14] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: /dotnet/api/system.management.automation.functioninfo +[08]: /dotnet/api/system.management.automation.filterinfo +[09]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[10]: xref:Microsoft.PowerShell.Management.Set-Location +[11]: xref:Microsoft.PowerShell.Management.Set-Item +[12]: xref:Microsoft.PowerShell.Core.Get-Help +[13]: about_Functions.md +[14]: about_Providers.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md index 214bc5fbe9ae..dfe2657a359f 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md @@ -303,8 +303,8 @@ function Get-SmallFiles { } ``` -In the function, you can use the `$Size` variable, which is the name defined for -the parameter. +In the function, you can use the `$Size` variable, which is the name defined +for the parameter. To use this function, type the following command: @@ -494,7 +494,7 @@ function Get-Pipeline process {"The value is: $_"} } -1,2,4 | Get-Pipeline +1, 2, 4 | Get-Pipeline ``` ```Output @@ -527,9 +527,9 @@ function Get-SumOfNumbers { end { $retValue } } -PS> 1,2,3,4 | Get-SumOfNumbers +PS> 1, 2, 3, 4 | Get-SumOfNumbers 10 -PS> Get-SumOfNumbers 1,2,3,4 +PS> Get-SumOfNumbers 1, 2, 3, 4 10 ``` @@ -553,7 +553,7 @@ If this function is run using the pipeline, it displays the following results: ```powershell -1,2,4 | Get-PipelineBeginEnd +1, 2, 4 | Get-PipelineBeginEnd ``` ```Output @@ -582,7 +582,7 @@ object at a time. The `$input` automatic variable is empty when the function reaches the `end` keyword. ```powershell -1,2,4 | Get-PipelineInput +1, 2, 4 | Get-PipelineInput ``` ```Output @@ -771,7 +771,7 @@ You can write help for a function using either of the two following methods: [05]: about_Automatic_Variables.md [06]: about_Automatic_Variables.md#using-enumerators [07]: about_Comment_Based_Help.md -[08]: about_Function_provider.md +[08]: about_Function_Provider.md [09]: about_Functions_Advanced_Methods.md [10]: about_Functions_Advanced_Parameters.md [11]: about_Functions_Advanced.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md index 8f249b18b170..3db5934d5904 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md @@ -9,6 +9,7 @@ title: about_Functions_Advanced # about_Functions_Advanced ## Short description + Introduces advanced functions that are a way to create cmdlets using scripts. ## Long description @@ -45,7 +46,7 @@ function Send-Greeting [CmdletBinding()] param( [Parameter(Mandatory=$true)] - [string] $Name + [string]$Name ) process diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md index ceb8158d787a..059ffdf02e45 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md @@ -121,7 +121,7 @@ function Get-SumOfNumbers { end { $retValue } } -PS> Get-SumOfNumbers 1,2,3,4 +PS> Get-SumOfNumbers 1, 2, 3, 4 10 PS> 1,2,3,4 | Get-SumOfNumbers 10 diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md index dd249ae0fa77..3d9e9ea60e50 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md @@ -585,7 +585,7 @@ function Test-Remainder { "${i}: $($Remaining[$i])" } } -Test-Remainder first one,two +Test-Remainder first one, two ``` ```Output @@ -1351,7 +1351,7 @@ This attribute was added in PowerShell 6.1.1. - [about_Functions_OutputTypeAttribute][13] -[01]: about_comment_based_help.md +[01]: about_Comment_Based_Help.md [02]: /dotnet/api/system.management.automation.runtimedefinedparameter [03]: /dotnet/standard/base-types/composite-formatting#composite-format-string [04]: /dotnet/standard/base-types/composite-formatting#format-string-component diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md index 9154bd0b649d..d4a81ad8aa6e 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md @@ -9,6 +9,7 @@ title: About_functions_argument_completion # about_Functions_Argument_Completion ## Short description + Argument completion is a feature of PowerShell that provide hints, enables discovery, and speeds up input entry of argument values. @@ -39,8 +40,7 @@ example, the value of the **Fruit** parameter can only be **Apple**, Param( [Parameter(Mandatory=$true)] [ValidateSet('Apple', 'Banana', 'Pear')] - [string[]] - $Fruit + [string[]]$Fruit ) ``` @@ -50,7 +50,7 @@ be used on any variable, not just parameters. ```powershell [ValidateSet('Chocolate', 'Strawberry', 'Vanilla')] -[string]$flavor = 'Strawberry' +[string]$Flavor = 'Strawberry' ``` The validation occurs whenever that variable is assigned even within the diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md index 268db10fdf3d..d1328b2b8b9c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md @@ -93,7 +93,8 @@ User Configuration\ > These **PowerShell Core Administrative Templates** don't include settings > for Windows PowerShell. For more information about acquiring other templates > and configuring Group policy, see -> [How to create and manage the Central Store for Group Policy Administrative Templates in Windows][gpstore]. +> [How to create and manage the Central Store for Group Policy Administrative +> Templates in Windows][gpstore]. ## Console session configuration diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Hash_Tables.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Hash_Tables.md index 5bc627dce2be..25d2bf72ac37 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Hash_Tables.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Hash_Tables.md @@ -10,6 +10,7 @@ title: about_Hash_Tables # about_Hash_Tables ## Short description + Describes how to create, use, and sort hashtables in PowerShell. ## Long description @@ -314,9 +315,9 @@ member notation or array index notation. ### Handling property name collisions If the key name collides with one of the property names of the **HashTable** -type, you can use the **psbase** [intrinsic member](about_Intrinsic_Members.md) -to access those properties. For example, if the key name is `keys` and you want -to return the collection of the **HashTable** keys, use this syntax: +type, you can use the **psbase** [intrinsic member][01] to access those +properties. For example, if the key name is `keys` and you want to return the +collection of the **HashTable** keys, use this syntax: ```powershell $hashtable.psbase.Keys @@ -332,7 +333,7 @@ ways. Each of the examples in this section has identical output. They iterate over the `$hash` variable defined here: ```powershell -$hash = [ordered]@{ Number = 1; Shape = "Square"; Color = "Blue"} +$hash = [ordered]@{Number = 1; Shape = "Square"; Color = "Blue"} ``` > [!NOTE] @@ -476,7 +477,7 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 441 24 54196 54012 571 5.10 1788 PowerShell -PS> $p.keys | ForEach-Object {$p.$_.handles} +PS> $p.Keys | ForEach-Object {$p.$_.Handles} 441 251 ``` @@ -504,7 +505,7 @@ PowerShell System.Diagnostics.Process (PowerShell) Notepad System.Diagnostics.Process (notepad) System.ServiceProcess.Servi... Running -PS> $p.keys +PS> $p.Keys PowerShell Notepad @@ -512,7 +513,7 @@ Status Name DisplayName ------ ---- ----------- Running winrm Windows Remote Management (WS-Manag... -PS> $p.keys | ForEach-Object {$_.name} +PS> $p.Keys | ForEach-Object {$_.Name} WinRM ``` @@ -605,7 +606,7 @@ The syntax is as follows: This method works only for classes that have a constructor that has no parameters. The object properties must be public and settable. -For more information, see [about_Object_Creation](about_Object_Creation.md). +For more information, see [about_Object_Creation][02]. ## ConvertFrom-StringData @@ -617,7 +618,7 @@ cmdlet safely in the Data section of a script, and you can use it with the Here-strings are especially useful when the values in the hashtable include quotation marks. For more information about here-strings, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][03]. The following example shows how to create a here-string of the user messages in the previous example and how to use `ConvertFrom-StringData` to convert them @@ -647,16 +648,25 @@ Msg2 She said, "Hello, World." Msg1 Type "Windows". ``` -For more information about here-strings, see -[about_Quoting_Rules](about_Quoting_Rules.md). +For more information about here-strings, see [about_Quoting_Rules][03]. ## See also -- [about_Arrays](about_Arrays.md) -- [about_Intrinsic_Members](about_Intrinsic_Members.md) -- [about_Object_Creation](about_Object_Creation.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Script_Internationalization](about_Script_Internationalization.md) -- [Import-LocalizedData](xref:Microsoft.PowerShell.Utility.Import-LocalizedData) -- [ConvertFrom-StringData](xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData) -- [System.Collections.Hashtable](/dotnet/api/system.collections.hashtable) +- [about_Arrays][04] +- [about_Intrinsic_Members][01] +- [about_Object_Creation][02] +- [about_Quoting_Rules][03] +- [about_Script_Internationalization][05] +- [Import-LocalizedData][06] +- [ConvertFrom-StringData][07] +- [System.Collections.Hashtable][08] + + +[01]: about_Intrinsic_Members.md +[02]: about_Object_Creation.md +[03]: about_Quoting_Rules.md +[04]: about_Arrays.md +[05]: about_Script_Internationalization.md +[06]: xref:Microsoft.PowerShell.Utility.Import-LocalizedData +[07]: xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData +[08]: /dotnet/api/system.collections.hashtable diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Hidden.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Hidden.md index 3dde29d0f314..b14f35fc7d6d 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Hidden.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Hidden.md @@ -9,6 +9,7 @@ title: about_Hidden # about_Hidden ## Short description + Describes the `hidden` keyword, which hides class members from default `Get-Member` results. @@ -16,9 +17,9 @@ Describes the `hidden` keyword, which hides class members from default When you use the `hidden` keyword in a script, you hide the members of a class by default. Hidden members do not display in the default results of the -`Get-Member` cmdlet, IntelliSense, or tab completion results. To display members -that you have hidden with the `hidden` keyword, add the **Force** parameter to a -`Get-Member` command. +`Get-Member` cmdlet, IntelliSense, or tab completion results. To display +members that you have hidden with the `hidden` keyword, add the **Force** +parameter to a `Get-Member` command. The `hidden` keyword can hide: @@ -47,11 +48,12 @@ PowerShell 5.0. ## EXAMPLE The following example shows how to use the `hidden` keyword in a class -definition. The **Car** class method, **Drive**, has a property, **rides**, that -does not need to be viewed or changed as it merely tallies the number of times -that **Drive** is called on the **Car** class. That metric that is not important -to users of the class (consider, for example, that when you are buying a car, -you do not ask the seller on how many drives the car has been taken). +definition. The **Car** class method, **Drive**, has a property, **rides**, +that does not need to be viewed or changed as it merely tallies the number of +times that **Drive** is called on the **Car** class. That metric that is not +important to users of the class (consider, for example, that when you are +buying a car, you do not ask the seller on how many drives the car has been +taken). Because there is little need for users of the class to change this property, we can hide the property from `Get-Member` and automatic completion results by @@ -113,8 +115,8 @@ ModelYear Property string ModelYear {get;set;} ``` Now, try running `Get-Member` again, but this time, add the `-Force` parameter. -Note that the results contain the hidden **rides** property, among other members -that are hidden by default. +Note that the results contain the hidden **rides** property, among other +members that are hidden by default. ```output PS C:\Windows\system32> $TestCar | Get-Member -Force diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_History.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_History.md index 6ec2b71d8e62..6c5e6438032c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_History.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_History.md @@ -9,6 +9,7 @@ title: about_History # about_History ## Short description + Describes how to get and run commands in the command history. ## Long description @@ -28,13 +29,13 @@ The PSReadLine history tracks the commands used in all PowerShell sessions. The history is written to a central file per host. That history file is available to all sessions and contains all past history. The history is not deleted when the session ends. Also, that history cannot be managed by the -`*-History` cmdlets. For more information, see -[about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md). +`*-History` cmdlets. For more information, see [about_PSReadLine][01]. ## Using the built-in session history The built-in history only tracks the commands used in the current session. The -history is not available to other sessions and is deleted when the session ends. +history is not available to other sessions and is deleted when the session +ends. ### History Cmdlets @@ -71,7 +72,7 @@ command history. > module. PSReadLine loads automatically when you start a PowerShell session. > With PSReadLine loaded, F7 and F9 are not bound to any > function. PSReadLine does not provide equivalent functionality. For more -> information, see [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md). +> information, see [about_PSReadLine][01]. ### MaximumHistoryCount @@ -90,10 +91,10 @@ To apply the setting, restart PowerShell. To save the new variable value for all your PowerShell sessions, add the assignment statement to a PowerShell profile. For more information about -profiles, see [about_Profiles](about_Profiles.md). +profiles, see [about_Profiles][02]. For more information about the `$MaximumHistoryCount` preference variable, see -[about_Preference_Variables](about_Preference_Variables.md). +[about_Preference_Variables][03]. ### Order of Commands in the History @@ -105,8 +106,15 @@ completed only when you exit the prompt level. ## See also -- [about_Line_Editing](about_Line_Editing.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md) -- [about_Variables](about_Variables.md) +- [about_Line_Editing][04] +- [about_Preference_Variables][03] +- [about_Profiles][02] +- [about_PSReadLine][01] +- [about_Variables][05] + + +[01]: ../../PSReadLine/About/about_PSReadLine.md +[02]: about_Profiles.md +[03]: about_Preference_Variables.md +[04]: about_Line_Editing.md +[05]: about_Variables.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Job_Details.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Job_Details.md index aeacf69680c9..145bff3783a0 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Job_Details.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Job_Details.md @@ -144,14 +144,15 @@ start the job. - When you use `Start-Job` to start a job on a local computer, the job consists of an executive parent job and a child job that runs the command. -- When you use the **AsJob** parameter of `Invoke-Command` to start a job on one or - more computers, the job consists of an executive parent job and a child job - for each job run on each computer. +- When you use the **AsJob** parameter of `Invoke-Command` to start a job on + one or more computers, the job consists of an executive parent job and a + child job for each job run on each computer. -- When you use `Invoke-Command` to run a `Start-Job` command on one or more remote - computers, the result is the same as a local command run on each remote - computer. The command returns a job object for each computer. The job object - consists of an executive parent job and one child job that runs the command. +- When you use `Invoke-Command` to run a `Start-Job` command on one or more + remote computers, the result is the same as a local command run on each + remote computer. The command returns a job object for each computer. The job + object consists of an executive parent job and one child job that runs the + command. The parent job represents all of the child jobs. When you manage a parent job, you also manage the associated child jobs. For example, if you stop a parent @@ -238,10 +239,10 @@ exist only in a particular session. Workflow jobs can be suspended and resumed. The cmdlets that you use to manage custom jobs depend on the job type. For -some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. Others -come with specialized cmdlets that manage only a particular type of job. For -detailed information about custom job types, see the help topics about the job -type. +some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. +Others come with specialized cmdlets that manage only a particular type of job. +For detailed information about custom job types, see the help topics about the +job type. To find the job type of a job, use the `Get-Job` cmdlet. `Get-Job` returns different job objects for different types of jobs. The value of the @@ -264,9 +265,10 @@ The following table lists the job types that come with PowerShell. | PSEventJob | Created using`Register-ObjectEvent` and specifying an | | | action with the **Action** parameter. | -NOTE: Before using the `Get-Job` cmdlet to get jobs of a particular type, verify -that the module that adds the job type is imported into the current session. -Otherwise, `Get-Job` does not get jobs of that type. +> [!NOTE] +> Before using the `Get-Job` cmdlet to get jobs of a particular type, verify +> that the module that adds the job type is imported into the current session. +> Otherwise, `Get-Job` does not get jobs of that type. ## Examples @@ -353,7 +355,7 @@ Id Name JobTriggers Command Enabled - [about_Jobs](about_Jobs.md) - [about_Remote](about_Remote.md) - [about_Remote_Jobs](about_Remote_Jobs.md) -- [about_Thread_Jobs](/powershell/module/microsoft.powershell.core/about/about_Thread_Jobs) +- [about_Thread_Jobs](about_Thread_Jobs.md) - [Invoke-Command](xref:Microsoft.PowerShell.Core.Invoke-Command) - [Get-Job](xref:Microsoft.PowerShell.Core.Get-Job) - [Remove-Job](xref:Microsoft.PowerShell.Core.Remove-Job) diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Join.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Join.md index 9554dd547533..195c33f6682e 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Join.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Join.md @@ -9,6 +9,7 @@ title: about_Join # about_Join ## Short description + Describes how the join operator (-join) combines multiple strings into a single string. @@ -23,8 +24,8 @@ in the command. The following diagram shows the syntax for the join operator. ```powershell --Join - -Join +-join + -join ``` #### Parameters diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Keywords.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Keywords.md index 9aa74ca3694d..79647f4f541d 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Keywords.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Keywords.md @@ -9,6 +9,7 @@ title: about_Language_Keywords # about_Language_Keywords ## Short description + Describes the keywords in the PowerShell scripting language. ## Long description @@ -183,8 +184,8 @@ do {} until () ## `dynamicparam` -Specifies one part of the body of a function, along with the `begin`, `process`, -and `end` keywords. Dynamic parameters are added at runtime. +Specifies one part of the body of a function, along with the `begin`, +`process`, and `end` keywords. Dynamic parameters are added at runtime. Syntax: diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Modes.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Modes.md index 0e4a1ed5138a..5ea47ece2d4b 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Modes.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Language_Modes.md @@ -10,6 +10,7 @@ title: about_Language_Modes # about_Language_Modes ## Short description + Explains language modes and their effect on PowerShell sessions. ## Long description @@ -338,7 +339,7 @@ Beginning in PowerShell 7.2, the `New-Object` cmdlet is disabled in [01]: /powershell/scripting/learn/remoting/jea/session-configurations -[02]: about_member-access_enumeration.md +[02]: about_Member-Access_Enumeration.md [03]: about_Session_Configuration_Files.md [04]: about_Session_Configurations.md [05]: xref:Microsoft.PowerShell.Core.New-PSSessionConfigurationFile diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md index a533fc20a3e7..68956b39b6a9 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md @@ -46,7 +46,7 @@ PowerShell supports configuring two categories of logging: ```powershell $psrl = Get-Module PSReadLine $psrl.LogPipelineExecutionDetails = $true - Get-Module PSReadline | Select-Object Name, LogPipelineExecutionDetails + Get-Module PSReadLine | Select-Object Name, LogPipelineExecutionDetails ``` ```Output @@ -295,11 +295,11 @@ To view PowerShell log data from a command line on macOS, use the `log` command in the **Terminal** or other shell host application. These commands can be run from **PowerShell**, **Z Shell**, or **Bash**. -In the following example, the `log` command is used to show the log data on your -system as it's occurring in realtime. The **process** parameter filters the log -data for only the `pwsh` process. If you have more than one instance of `pwsh` -running, the **process** parameter also accepts a process ID as its value. The -**level** parameter shows messages at the specified level and below. +In the following example, the `log` command is used to show the log data on +your system as it's occurring in realtime. The **process** parameter filters +the log data for only the `pwsh` process. If you have more than one instance of +`pwsh` running, the **process** parameter also accepts a process ID as its +value. The **level** parameter shows messages at the specified level and below. ```powershell log stream --predicate "subsystem == 'com.microsoft.powershell'" --level info diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Windows.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Windows.md index 444033cc0dea..324436db8d26 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Windows.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Logging_Windows.md @@ -10,6 +10,7 @@ title: about_Logging_Windows # about_Logging_Windows ## Short description + PowerShell logs internal operations from the engine, providers, and cmdlets to the Windows event log. @@ -37,7 +38,7 @@ PowerShell supports configuring two categories of logging: ```powershell $psrl = Get-Module PSReadLine $psrl.LogPipelineExecutionDetails = $true - Get-Module PSReadline | Select-Object Name, LogPipelineExecutionDetails + Get-Module PSReadLine | Select-Object Name, LogPipelineExecutionDetails ``` ```Output @@ -202,8 +203,7 @@ private key: ```powershell Get-WinEvent Microsoft-Windows-PowerShell/Operational | - Where-Object Id -eq 4104 | - Unprotect-CmsMessage + Where-Object Id -eq 4104 | Unprotect-CmsMessage ``` ## See also diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md index feb4702fe8b1..245510ab0d76 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md @@ -57,8 +57,8 @@ During member-access enumeration for a property, the operator returns the value of the property for each item that has that property. If no items have the specified property, the operator returns `$null`. -During member-access enumeration for a method, the operator attempts to call the -method on each item in the collection. If any item in the collection does +During member-access enumeration for a method, the operator attempts to call +the method on each item in the collection. If any item in the collection does not have the specified method, the operator returns the **MethodNotFound** exception. @@ -333,7 +333,7 @@ in the array. ### Collections containing PSCustomObject instances If the collection of objects contains instances of **PSCustomObject** items, -PowerShell unexpectedly retruns `$null` values when the accessed property is +PowerShell unexpectedly returns `$null` values when the accessed property is missing. In the following examples at least one object has the referenced property. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Methods.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Methods.md index d813cdd53d13..a87a25b10d4c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Methods.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Methods.md @@ -9,6 +9,7 @@ title: about_Methods # about_Methods ## Short description + Describes how to use methods to perform actions on objects in PowerShell. ## Long description @@ -114,8 +115,8 @@ two method signatures: ``` The first method signature takes the destination file name (and a path). The -following example uses the first `CopyTo` method to copy the `Final.txt` file to -the `C:\Bin` directory. +following example uses the first `CopyTo` method to copy the `Final.txt` file +to the `C:\Bin` directory. ```powershell (Get-ChildItem c:\final.txt).CopyTo("c:\bin\final.txt") diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Module_Manifests.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Module_Manifests.md index 4d0f0597104f..b31966d091eb 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Module_Manifests.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Module_Manifests.md @@ -9,6 +9,7 @@ title: about_Module_Manifests # about_Module_Manifests ## Short description + Describes the settings and practices for writing module manifest files. ## Long description @@ -1558,10 +1559,10 @@ imported as `Get-ExampleItem`. [03]: /powershell/gallery/concepts/package-manifest-affecting-ui [04]: /powershell/scripting/dev-cross-plat/performance/module-authoring-considerations [05]: /powershell/scripting/developer/module/supporting-updatable-help -[06]: about_experimental_features.md#declaring-experimental-features-in-modules-written-in-powershell +[06]: about_Experimental_Features.md#declaring-experimental-features-in-modules-written-in-powershell [07]: about_Format.ps1xml.md [08]: about_Language_Modes.md -[09]: about_powershell_editions.md +[09]: about_Powershell_Editions.md [10]: about_Types.ps1xml.md [11]: about_Updatable_Help.md [13]: xref:Microsoft.PowerShell.Core.New-ModuleManifest diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Modules.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Modules.md index 98e2a2a7b3dc..e974b2c664d3 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Modules.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Modules.md @@ -9,6 +9,7 @@ title: about_Modules # about_Modules ## Short description + Explains how to install, import, and use PowerShell modules. ## Long description @@ -247,8 +248,7 @@ For example, to find the commands in the **BitsTransfer** module, type: Get-Command -Module BitsTransfer ``` -For more information about the `Get-Command` cmdlet, see -[Get-Command][11]. +For more information about the `Get-Command` cmdlet, see [Get-Command][11]. ## Remove a module diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Object_Creation.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Object_Creation.md index 900609fad301..8fba97cbda98 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Object_Creation.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Object_Creation.md @@ -289,7 +289,7 @@ New-PSSession -ComputerName Server01 -SessionOption @{ IdleTimeout=43200000 SkipCnCheck=$True } -Register-ScheduledJob Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ +Register-ScheduledJob -Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ Frequency="Daily" At="15:00" } diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Objects.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Objects.md index bd8e9597e7b7..c39897e47c53 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Objects.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Objects.md @@ -9,6 +9,7 @@ title: about_Objects # about_Objects ## Short description + Provides essential information about objects in PowerShell. ## Long description @@ -37,7 +38,7 @@ in commands to take action and manage data. You can discover an objects properties and methods using [Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member) or the `psobject` - [intrinsic member](about_Intrinsic_Members.md). +[intrinsic member](about_Intrinsic_Members.md). ## Objects in Pipelines diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md index c2f0e30811b8..521b3e4ca40c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md @@ -9,6 +9,7 @@ title: about_Operator_Precedence # about_Operator_Precedence ## Short description + Lists the PowerShell operators in precedence order. ## Long description @@ -120,8 +121,8 @@ $read_only = ( Get-ChildItem *.txt | Where-Object {$_.isReadOnly} ) Because the pipeline operator (`|`) has a higher precedence than the assignment operator (`=`), the files that the `Get-ChildItem` cmdlet gets are sent to the -`Where-Object` cmdlet for filtering before they are assigned to the `$read_only` -variable. +`Where-Object` cmdlet for filtering before they are assigned to the +`$read_only` variable. The following example demonstrates that the index operator takes precedence over the cast operator. @@ -193,7 +194,7 @@ are reading and maintaining your scripts. [assign]: about_Assignment_Operators.md [compare]: about_Comparison_Operators.md [join]: about_Join.md -[logic]: about_logical_operators.md +[logic]: about_Logical_Operators.md [ops]: about_Operators.md [redir]: about_Redirection.md [scopes]: about_Scopes.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md index d1b23767a2d4..149d696bddb9 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md @@ -9,6 +9,7 @@ title: about_Operators # about_Operators ## Short description + Describes the operators that are supported by PowerShell. ## Long description @@ -250,10 +251,10 @@ For more information, see [about_Parsing][08]. This example stores a command in a string and executes it using the call operator. -``` -PS> $c = "get-executionpolicy" +```powershell +PS> $c = "Get-ExecutionPolicy" PS> $c -get-executionpolicy +Get-ExecutionPolicy PS> & $c AllSigned ``` @@ -261,7 +262,7 @@ AllSigned The call operator doesn't parse strings. This means that you can't use command parameters within a string when you use the call operator. -``` +```powershell PS> $c = "Get-Service -Name Spooler" PS> $c Get-Service -Name Spooler @@ -275,7 +276,7 @@ try again. The [Invoke-Expression][25] cmdlet can execute code that causes parsing errors when using the call operator. -``` +```powershell PS> & "1+1" &: The term '1+1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was @@ -292,7 +293,7 @@ the contents of the quoted string instead of running the script. The call operator allows you to execute the contents of the string containing the filename. -``` +```powershell PS C:\Scripts> Get-ChildItem Directory: C:\Scripts @@ -464,7 +465,7 @@ objects to be formatted on the right side of the operator. "{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi ``` -```output +```Output 1 hello 3.14 ``` @@ -476,7 +477,7 @@ formatted string to. "{0:00} {1:000} {2:000000}" -f 7, 24, 365 ``` -```output +```Output 07 024 000365 ``` @@ -501,7 +502,7 @@ value. Given a list of indices, the index operator returns a list of members corresponding to those indices. -``` +```powershell PS> $a = 1, 2, 3 PS> $a[0] 1 @@ -522,7 +523,7 @@ $h = @{key="value"; name="PowerShell"; version="2.0"} $h["name"] ``` -```output +```Output PowerShell ``` @@ -531,7 +532,7 @@ $x = [xml]"Once upon a time..." $x["doc"] ``` -```output +```Output intro ----- Once upon a time... @@ -541,7 +542,7 @@ When an object isn't an indexed collection, using the index operator to access the first element returns the object itself. Index values beyond the first element return `$null`. -``` +```powershell PS> (2)[0] 2 PS> (2)[-1] @@ -706,7 +707,7 @@ expression. ```powershell $myProcess.peakWorkingSet -(Get-Process PowerShell).kill() +(Get-Process PowerShell).Kill() 'OS', 'Platform' | Foreach-Object { $PSVersionTable. $_ } ``` @@ -871,9 +872,9 @@ ${a}?[0] [10]: about_If.md [11]: about_Jobs.md [12]: about_Join.md -[13]: about_logical_operators.md +[13]: about_Logical_Operators.md [14]: about_Member-Access_Enumeration.md -[15]: about_operator_precedence.md +[15]: about_Operator_Precedence.md [16]: About_Pipeline_Chain_Operators.md [17]: about_Preference_Variables.md#ofs [18]: about_Redirection.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index 0ef19bc30d29..34801c5593ce 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -9,6 +9,7 @@ title: about_PSConsoleHostReadLine # about_PSConsoleHostReadLine ## Short description + Explains how to customize how PowerShell reads input at the console prompt. ## Long description diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSCustomObject.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSCustomObject.md index 650a0aaab96d..966fcc4fad27 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSCustomObject.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSCustomObject.md @@ -9,6 +9,7 @@ title: about_PSCustomObject # about_PSCustomObject ## Short description + Explains the differences between the `[psobject]` and `[pscustomobject]` type accelerators. @@ -295,6 +296,6 @@ properties. [01]: about_Object_Creation.md [02]: about_Objects.md -[03]: about_type_accelerators.md +[03]: about_Type_Accelerators.md [04]: xref:System.Management.Automation.PSCustomObject [05]: xref:System.Management.Automation.PSObject diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSItem.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSItem.md index 716b8c520ca3..68a66e3a62cf 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PSItem.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PSItem.md @@ -41,9 +41,9 @@ cases. ## ForEach-Object Process -The [ForEach-Object][02] cmdlet is designed to operate -on objects in the pipeline, executing the **Process** parameter's scriptblock -once for every object in the pipeline. +The [ForEach-Object][02] cmdlet is designed to operate on objects in the +pipeline, executing the **Process** parameter's scriptblock once for every +object in the pipeline. You can use `$PSItem` in the **Process** parameter's scriptblock but not in the **Begin** or **End** parameter scriptblocks. If you reference `$PSItem` in the @@ -374,9 +374,9 @@ with the default format for the current culture by casting the value to ## See also - [about_Arrays][04] -- [about_automatic_variables][01] +- [about_Automatic_Variables][01] - [about_Comparison_Operators][12] -- [about_functions][08] +- [about_Functions][08] - [about_Script_Blocks][14] - [about_Switch][07] - [ForEach-Object][02] diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PackageManagement.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PackageManagement.md index f7f12ea24082..f4457b4624cd 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PackageManagement.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PackageManagement.md @@ -9,6 +9,7 @@ title: about_PackageManagement # about_PackageManagement ## Short description + PackageManagement is an aggregator for software package managers. ## Long description @@ -41,8 +42,7 @@ us define some terms: stored in a specific package source. The PackageManagement module includes the following cmdlets. For more -information, see the [PackageManagement](/powershell/module/packagemanagement) -help. +information, see the [PackageManagement][01] help. - `Get-PackageProvider`: Returns a list of package providers that are connected to PackageManagement. @@ -100,7 +100,7 @@ More Information About the PackageManagement Project For more information about the PackageManagement open development project, including how to create a PackageManagement package provider, see the -PackageManagement project on GitHub at https://oneget.org. +PackageManagement project on GitHub at [https://oneget.org][02]. ## See also @@ -114,3 +114,7 @@ PackageManagement project on GitHub at https://oneget.org. - [Register-PackageSource](xref:PackageManagement.Register-PackageSource) - [Set-PackageSource](xref:PackageManagement.Set-PackageSource) - [Unregister-PackageSource](xref:PackageManagement.Unregister-PackageSource) + + +[01]: /powershell/module/packagemanagement +[02]: https://oneget.org diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md index 7644e361dd4f..97b5f2c7f221 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md @@ -93,6 +93,6 @@ example, see the [Visualize parameter binding][01] article. [01]: /powershell/scripting/learn/deep-dives/visualize-parameter-binding -[02]: about_functions_advanced_parameters.md#valuefrompipeline-argument -[03]: about_functions_advanced_parameters.md#valuefrompipelinebypropertyname-argument +[02]: about_Functions_Advanced_Parameters.md#valuefrompipeline-argument +[03]: about_Functions_Advanced_Parameters.md#valuefrompipelinebypropertyname-argument [04]: xref:Microsoft.PowerShell.Utility.Trace-Command diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md index 6c79cdf1465c..4df5db7e81cc 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md @@ -8,6 +8,7 @@ title: about_Parameter_Sets # about_Parameter_Sets ## Short description + Describes how to define and use parameter sets in advanced functions. ## Long description @@ -125,9 +126,9 @@ function Measure-Lines { } foreach ($file in $Files) { $result = [ordered]@{ } - $result.Add('File', $file.fullname) + $result.Add('File', $file.FullName) - $content = Get-Content -LiteralPath $file.fullname + $content = Get-Content -LiteralPath $file.FullName if ($Lines) { $result.Add('Lines', $content.Length) } @@ -162,7 +163,7 @@ which parameters can be used in each parameter set. ```powershell (Get-Command Measure-Lines).ParameterSets | - Select-Object -Property @{n='ParameterSetName';e={$_.name}}, + Select-Object -Property @{n='ParameterSetName';e={$_.Name}}, @{n='Parameters';e={$_.ToString()}} ``` @@ -271,4 +272,4 @@ $Var4 = 3 ``` -[01]: about_functions_cmdletbindingattribute.md +[01]: about_Functions_CmdletBindingAttribute.md diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters.md index e833762abee5..8e97e5850e81 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters.md @@ -9,6 +9,7 @@ title: about_Parameters # about_Parameters ## Short description + Describes how to work with command parameters in PowerShell. ## Long description @@ -30,8 +31,8 @@ a value, but do not require the parameter name in the command. The type of parameters and the requirements for those parameters vary. To find information about the parameters of a command, use the `Get-Help` cmdlet. For -example, to find information about the parameters of the `Get-ChildItem` cmdlet, -type: +example, to find information about the parameters of the `Get-ChildItem` +cmdlet, type: ```powershell Get-Help Get-ChildItem @@ -178,8 +179,8 @@ Get-Service -Name $s #### Accepts Pipeline Input -This setting indicates whether you can use the pipeline operator (`|`) to send a -value to the parameter. +This setting indicates whether you can use the pipeline operator (`|`) to send +a value to the parameter. ``` Value Description diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index dd58344236d3..2793ada88d15 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -118,7 +118,7 @@ using an array. This example sets the default value of the ```powershell $PSDefaultParameterValues = @{ - 'Invoke-Command:ComputerName' = 'Server01','Server02' + 'Invoke-Command:ComputerName' = 'Server01', 'Server02' } ``` diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parsing.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parsing.md index 9a358c6e2eb3..2d30f132a3f7 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parsing.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parsing.md @@ -412,8 +412,7 @@ TestExe -echoargs --% """%ProgramFiles(x86)%\Microsoft\\"" > [ProcessStartInfo.ArgumentList][01]. PowerShell 7.3 also added the ability to trace parameter binding for native -commands. For more information, see -[Trace-Command][07]. +commands. For more information, see [Trace-Command][07]. ## Passing arguments to PowerShell commands @@ -468,9 +467,9 @@ Arg 3 is <-c> ## Tilde (~) The tilde character (`~`) has special meaning in PowerShell. When it's used -with PowerShell commands at the beginning of a path, the tilde character is -expanded to the user's home directory. If the tilde character is used anywhere -else in a path, it's treated as a literal character. +with PowerShell commands at the beginning of a path, PowerShell expands the +tilde character to the user's home directory. If you use the tilde character +anywhere else in a path, it's treated as a literal character. ```powershell PS D:\temp> $PWD 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 d3e51fd3f609..dc6bdaace242 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -272,8 +272,8 @@ pipeline to display a table of service objects. Get-Service | Format-Table -Property Name, DependentServices ``` -Functionally, this is like using the **InputObject** parameter of `Format-Table` -to submit the object collection. +Functionally, this is like using the **InputObject** parameter of +`Format-Table` to submit the object collection. For example, we can save the collection of services to a variable that's passed using the **InputObject** parameter. @@ -631,9 +631,9 @@ Get-Process | Where-Object CPU | Where-Object Path [02]: #investigating-pipeline-errors -[03]: about_command_syntax.md -[04]: about_foreach.md -[05]: about_objects.md -[06]: about_parameters.md +[03]: about_Command_Syntax.md +[04]: about_Foreach.md +[05]: about_Objects.md +[06]: about_Parameters.md [07]: about_Redirection.md [08]: xref:System.Data.DataTable.Rows 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 3d543eea8c36..f1e5b73b2629 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 @@ -9,6 +9,7 @@ title: about_PowerShell_Editions # about_PowerShell_Editions ## Short description + Different editions of PowerShell run on different underlying runtimes. ## Long description @@ -110,7 +111,12 @@ 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' +$newModuleManifestSplat = @{ + Path = '.\TestModuleWithEdition.psd1' + CompatiblePSEditions = 'Desktop', 'Core' + PowerShellVersion = '5.1' +} +New-ModuleManifest @newModuleManifestSplat $ModuleInfo = Test-ModuleManifest -Path .\TestModuleWithEdition.psd1 $ModuleInfo.CompatiblePSEditions ``` diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index d491f586b7eb..f0f2346e86bb 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -1,7 +1,7 @@ --- description: Describes the features of PowerShell that use ANSI escape sequences and the terminal hosts that support them. Locale: en-US -ms.date: 09/29/2023 +ms.date: 08/27/2024 schema: 2.0.0 title: about_ANSI_terminals --- diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md index 45768ed59a21..77070f700962 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -1018,7 +1018,8 @@ PS> [Collections.Generic.Dictionary[string, int]]::new()['nosuchkey'] # No output ($null) PS> [Collections.Generic.Dictionary[string, int]]::new().Item('nosuchkey') -GetValueInvocationException: Exception getting "Item": "The given key 'nosuchkey' was not present in the dictionary." +GetValueInvocationException: Exception getting "Item": "The given key +'nosuchkey' was not present in the dictionary." ``` ## Member-access enumeration diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md index 048248822add..2e393200a84e 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md @@ -884,7 +884,7 @@ Set-Variable -Name a -Value 1, 2, 3 [01]: /powershell/scripting/learn/glossary#scalar-value [02]: about_Arrays.md [03]: about_Hash_Tables.md -[04]: about_operators.md#null-coalescing-operator- +[04]: about_Operators.md#null-coalescing-operator- [05]: about_Variables.md [06]: xref:Microsoft.PowerShell.Management.Clear-Item [07]: xref:Microsoft.PowerShell.Utility.Clear-Variable diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index 299335f092ea..5b8d63b04f65 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -7,6 +7,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Automatic_Variables --- + # about_Automatic_Variables ## Short description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md index 3afa59d77fdb..f2b2b2388449 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md @@ -2,6 +2,7 @@ description: Describes how to call generic methods of .NET types in PowerShell Locale: en-US ms.date: 02/02/2022 +online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_calling_generic_methods?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Calling_Generic_Methods --- diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md index b25670c39ca5..8b7a3a036b02 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md @@ -42,7 +42,7 @@ operating system and integration with other tools. it was imported. The name, as stored in the session state, is used `Update-Help` when looking for new help files. The web service that serves the help files for Microsoft uses a - ase-sensitive filesystem. When the case of the imported name of the module + case-sensitive filesystem. When the case of the imported name of the module doesn't match, `Update-Help` can't find the help files and reports an error. ## Related links diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index fcbfc9c4039e..4955759a1d0e 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -6,6 +6,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Classes_Constructors --- + # about_Classes_Constructors ## Short description @@ -539,7 +540,7 @@ PowerShell class constructors have the following limitations: - [about_Classes_Methods][01] - [about_Classes_Properties][09] - + [01]: about_Classes_Methods.md [02]: #static-constructors [03]: about_Classes_Properties.md#default-property-values diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md index 60067de22216..37e204caccca 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md @@ -6,6 +6,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Classes_Inheritance --- + # about_Classes_Inheritance ## Short description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Methods.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Methods.md index 7373567f7e33..21d1216d8314 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Methods.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Methods.md @@ -6,6 +6,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Classes_Methods --- + # about_Classes_Methods ## Short description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Properties.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Properties.md index f25c7f547ff6..a856c783ec86 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Properties.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Classes_Properties.md @@ -6,6 +6,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Classes_Properties --- + # about_Classes_Properties ## Short description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md index 13ac047905af..997b229b5316 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md @@ -171,7 +171,7 @@ function Get-Function { } The following are valid comment-based help keywords. These keywords can appear in any order in the comment-based help, and they aren't case-sensitive. The -keywords are listed in in this article in the order that they typically appear +keywords are listed in this article in the order that they typically appear in a help topic. ### .SYNOPSIS diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md index cc50f3a9d15e..d2dce48e7c76 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md @@ -1,7 +1,7 @@ --- description: Describes how to create and use functions in PowerShell. Locale: en-US -ms.date: 06/10/2024 +ms.date: 06/26/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Functions diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md index c23c30df4016..7e87285cf7a0 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md @@ -1,7 +1,7 @@ --- description: Explains the various argument completion options available for function parameters. Locale: en-US -ms.date: 10/22/2021 +ms.date: 01/04/2022 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions_argument_completion?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: About_functions_argument_completion diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md index 3d11ec2fccaa..7e3f19339a3f 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Job_Details.md @@ -266,9 +266,10 @@ The following table lists the job types that come with PowerShell. | PSEventJob | Created using`Register-ObjectEvent` and specifying an | | | action with the **Action** parameter. | -NOTE: Before using the `Get-Job` cmdlet to get jobs of a particular type, -verify that the module that adds the job type is imported into the current -session. Otherwise, `Get-Job` does not get jobs of that type. +> [!NOTE] +> Before using the `Get-Job` cmdlet to get jobs of a particular type, verify +> that the module that adds the job type is imported into the current session. +> Otherwise, `Get-Job` does not get jobs of that type. ## Examples diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md index 336b867ee933..6080dc90e41e 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Join.md @@ -6,6 +6,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Join --- + # about_Join ## Short description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md index c4397eb68650..bb879fdc1a8f 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Language_Keywords.md @@ -284,7 +284,7 @@ value of the `%ERRORLEVEL%` environment variable. Any argument that is non-numeric or outside the platform-specific range is translated to the value of `0`. -In the following example, the user sets the error level variable value to **4** +In the following example, the user sets the error level variable value to `4` by adding `exit 4` to the script file `test.ps1`. ```cmd diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md index a5617df59b3c..9f0394e7f3a5 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Objects.md @@ -6,6 +6,7 @@ online version: https://learn.microsoft.com/powershell/module/microsoft.powershe schema: 2.0.0 title: about_Objects --- + # about_Objects ## Short description diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md index 68013811edca..433f2b8db3c1 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md @@ -187,7 +187,6 @@ are reading and maintaining your scripts. - [about_Redirection][redir] - [about_Scopes][scopes] - [about_Split][split] -- [about_Type_Operators][type] [math]: about_Arithmetic_Operators.md diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md index 4d7d5483fe25..16909c2fb045 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PSCustomObject.md @@ -1,7 +1,7 @@ --- description: Explains the differences between the [psobject] and [pscustomobject] type accelerators. Locale: en-US -ms.date: 10/11/2023 +ms.date: 07/02/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSCustomObject diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index a9002e4bfa78..6d5d896fd91c 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -111,7 +111,12 @@ 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' +$newModuleManifestSplat = @{ + Path = '.\TestModuleWithEdition.psd1' + CompatiblePSEditions = 'Desktop', 'Core' + PowerShellVersion = '5.1' +} +New-ModuleManifest @newModuleManifestSplat $ModuleInfo = Test-ModuleManifest -Path .\TestModuleWithEdition.psd1 $ModuleInfo.CompatiblePSEditions ``` diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index 89b6f13d14a0..f0f2346e86bb 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -1,7 +1,7 @@ --- description: Describes the features of PowerShell that use ANSI escape sequences and the terminal hosts that support them. Locale: en-US -ms.date: 09/29/2023 +ms.date: 08/27/2024 schema: 2.0.0 title: about_ANSI_terminals --- @@ -253,7 +253,7 @@ The following values of `$env:TERM` change the behavior as follows: - `dumb` - sets `$Host.UI.SupportsVirtualTerminal = $false` - `xterm-mono` - sets `$PSStyle.OutputRendering = PlainText` -- `xtermm` - sets `$PSStyle.OutputRendering = PlainText` +- `xterm` - sets `$PSStyle.OutputRendering = PlainText` If `$env:NO_COLOR` exists, then `$PSStyle.OutputRendering` is set to **PlainText**. For more information about the **NO_COLOR** environment diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Alias_Provider.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Alias_Provider.md index 25041abb4868..062f5be1eef4 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Alias_Provider.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Alias_Provider.md @@ -40,28 +40,27 @@ The aliases have no child items. The **Alias** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] PowerShell includes a set of cmdlets that are designed to view and to change aliases. When you use **Alias** cmdlets, you do not need to specify the `Alias:` drive in the name. This article does not cover working with **Alias** cmdlets. -- [Export-Alias](xref:Microsoft.PowerShell.Utility.Export-Alias) -- [Get-Alias](xref:Microsoft.PowerShell.Utility.Get-Alias) -- [Import-Alias](xref:Microsoft.PowerShell.Utility.Import-Alias) -- [New-Alias](xref:Microsoft.PowerShell.Utility.New-Alias) -- [Set-Alias](xref:Microsoft.PowerShell.Utility.Set-Alias) +- [Export-Alias][07] +- [Get-Alias][08] +- [Import-Alias][09] +- [New-Alias][10] +- [Set-Alias][11] ## Types exposed by this provider -Each alias is an instance of the -[System.Management.Automation.AliasInfo](/dotnet/api/system.management.automation.aliasinfo) +Each alias is an instance of the [System.Management.Automation.AliasInfo][12] class. ## Navigating the Alias drive @@ -87,11 +86,8 @@ path. > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases on Windows and `dir` -> on Linux and macOS for [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for -> [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` -> is an alias for -> [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> on Linux and macOS for [Get-ChildItem][13], `cd` is an alias for +> [Set-Location][02] and `pwd` is an alias for [Get-Location][01]. ### Displaying the Contents of the Alias: drive @@ -198,7 +194,7 @@ cmdlet. The `-Options` parameter is available in `Set-Item` when you use it with the **Alias** or **Function** provider. ```powershell -Set-Item -Path Alias:dir -Options "AllScope,ReadOnly" +Set-Item -Path Alias:dir -Options "AllScope, ReadOnly" ``` ### Change an aliases referenced command @@ -293,8 +289,8 @@ Determines the value of the **Options** property of an alias. #### Cmdlets supported -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item) +- [New-Item][04] +- [Set-Item][14] ## Using the pipeline @@ -309,10 +305,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system -drive or use the `-Path` parameter of -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system -drive. +[Get-Help][15] command in a file system drive or use the `-Path` parameter of +[Get-Help][15] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -324,5 +318,24 @@ Get-Help Get-ChildItem -Path alias: ## See also -- [about_Aliases](about_Aliases.md) -- [about_Providers](about_Providers.md) +- [about_Aliases][16] +- [about_Providers][17] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: xref:Microsoft.PowerShell.Utility.Export-Alias +[08]: xref:Microsoft.PowerShell.Utility.Get-Alias +[09]: xref:Microsoft.PowerShell.Utility.Import-Alias +[10]: xref:Microsoft.PowerShell.Utility.New-Alias +[11]: xref:Microsoft.PowerShell.Utility.Set-Alias +[12]: /dotnet/api/system.management.automation.aliasinfo +[13]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[14]: xref:Microsoft.PowerShell.Management.Set-Item +[15]: xref:Microsoft.PowerShell.Core.Get-Help +[16]: about_Aliases.md +[17]: about_Providers.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Aliases.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Aliases.md index 510b3c722109..289d13f7c837 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Aliases.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Aliases.md @@ -129,8 +129,8 @@ in the current session, type: Get-Alias ``` -To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. For -example, to get aliases that begin with "p", type: +To get particular aliases, use the Name parameter of the `Get-Alias` cmdlet. +For example, to get aliases that begin with "p", type: ```powershell Get-Alias -Name p* diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md index bf5a74260169..c5a74f24f094 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md @@ -203,7 +203,7 @@ result without losing precision. For example: (2 + 3.1).GetType().FullName ``` -```output +```Output 5.1 System.Int32 System.Double @@ -217,7 +217,7 @@ is widened to accommodate the result, as in the following example: (512MB * 512MB).GetType().FullName ``` -```output +```Output System.Int32 System.Double ``` @@ -230,7 +230,7 @@ the unsigned integer is too large to be cast to `Int32`: ([int32]::minvalue + [uint32]::maxvalue).GetType().FullName ``` -```output +```Output System.Int64 ``` @@ -269,8 +269,8 @@ PS> [ulong](9223372036854775807 + 2) 9223372036854775808 ``` -Defining the larger value as `[ulong]` first avoids the problem and produces the -correct result. +Defining the larger value as `[ulong]` first avoids the problem and produces +the correct result. ```powershell PS> 9223372036854775807ul + 2 @@ -327,7 +327,7 @@ $b = "A","B","C" $a + $b ``` -```output +```Output 1 2 3 @@ -390,7 +390,7 @@ $hash2 = @{c1="Server01"; c2="Server02"} $hash1 + $hash2 ``` -```output +```Output Name Value ---- ----- c2 Server02 @@ -409,7 +409,7 @@ $hash2 = @{c1="Server01"; c="Server02"} $hash1 + $hash2 ``` -```output +```Output OperationStopped: Line | 3 | $hash1 + $hash2 @@ -427,7 +427,7 @@ $array2 = $array1 + $hash1 $array2 ``` -```output +```Output 0 Hello World @@ -448,7 +448,7 @@ However, you can't add any other type to a hash table. $hash1 + 2 ``` -```output +```Output InvalidOperation: A hash table can only be added to another hash table. ``` @@ -463,7 +463,7 @@ $array = @() $array ``` -```output +```Output 0 1 2 @@ -508,7 +508,7 @@ results are then added using the `+` operator. Get-Process | Where-Object { ($_.ws * 2) -gt 50mb } ``` -```output +```Output Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 1896 39 50968 30620 264 1,572.55 1104 explorer diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Arrays.md index 9d35a55c30f2..2b8392cf9e24 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -639,8 +639,8 @@ The value of `mode` must be a [WhereOperatorSelectionMode][02] enum value: - `Default` (`0`) - Return all items - `First` (`1`) - Return the first item - `Last` (`2`) - Return the last item -- `SkipUntil` (`3`) - Skip items until condition is true, return all the remaining - items (including the first item for which the condition is true) +- `SkipUntil` (`3`) - Skip items until condition is true, return all the + remaining items (including the first item for which the condition is true) - `Until` (`4`) - Return all items until condition is true - `Split` (`5`) - Return an array of two elements - The first element contains matching items @@ -1018,8 +1018,8 @@ PS> [Collections.Generic.Dictionary[string, int]]::new()['nosuchkey'] # No output ($null) PS> [Collections.Generic.Dictionary[string, int]]::new().Item('nosuchkey') -GetValueInvocationException: Exception getting "Item": "The given key 'nosuchkey' - was not present in the dictionary." +GetValueInvocationException: Exception getting "Item": "The given key +'nosuchkey' was not present in the dictionary." ``` ## Member-access enumeration diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md index 0496f5b061ec..eca6c6885348 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md @@ -199,7 +199,7 @@ $a += 2 $a ``` -``` +```Output 6 ``` @@ -646,8 +646,7 @@ $x 100 ``` -For more information, see -[Null-coalescing operator][04]. +For more information, see [Null-coalescing operator][04]. ## Microsoft .NET types diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index 812e618379eb..17ad32f40902 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -422,7 +422,7 @@ the objects. ```powershell $a = "one", $null, "three" -$a.count +$a.Count ``` ```Output @@ -433,7 +433,7 @@ If you pipe the `$null` variable to the `ForEach-Object` cmdlet, it generates a value for `$null`, just as it does for the other objects ```powershell -"one", $null, "three" | ForEach-Object { "Hello " + $_} +"one", $null, "three" | ForEach-Object {"Hello " + $_} ``` ```Output @@ -451,8 +451,8 @@ were ignored. ```powershell $calendar = @($null, $null, "Meeting", $null, $null, "Team Lunch", $null) -$days = "Sunday","Monday","Tuesday","Wednesday","Thursday", - "Friday","Saturday" +$days = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday" $currentDay = 0 foreach($day in $calendar) { @@ -744,10 +744,9 @@ isn't considered best practice. ### MoveNext -The [MoveNext][76] method -advances the enumerator to the next element of the collection. **MoveNext** -returns `True` if the enumerator was successfully advanced, `False` if the -enumerator has passed the end of the collection. +The [MoveNext][76] method advances the enumerator to the next element of the +collection. **MoveNext** returns `True` if the enumerator was successfully +advanced, `False` if the enumerator has passed the end of the collection. > [!NOTE] > The **Boolean** value returned by **MoveNext** is sent to the output stream. diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Break.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Break.md index aaf71bb6d45d..c23c711a2e5a 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Break.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Break.md @@ -123,7 +123,8 @@ even pass control across script and function call boundaries. ## Using `break` in a `switch` statement -In a `switch`construct, `break` causes PowerShell to exit the `switch` code block. +In a `switch`construct, `break` causes PowerShell to exit the `switch` code +block. The `break` keyword is used to leave the `switch` construct. For example, the following `switch` statement uses `break` statements to test for the most @@ -190,8 +191,8 @@ function test { test ``` -Notice that execution stops at the exception. The `After loop` is never reached. -The exception is re-thrown after the `trap` executes. +Notice that execution stops at the exception. The `After loop` is never +reached. The exception is re-thrown after the `trap` executes. ```Output Before loop diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md index a07f61916d84..45dac7852da8 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Built-in_Functions.md @@ -69,8 +69,8 @@ This function clears the screen. For more information, see ## `TabExpansion2` -This is the default function to use for tab expansion. For more information, see -[TabExpansion2](xref:Microsoft.PowerShell.Core.TabExpansion2). +This is the default function to use for tab expansion. For more information, +see [TabExpansion2](xref:Microsoft.PowerShell.Core.TabExpansion2). ## `oss` diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md index 2bc88d87cfac..a28d8c135d61 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Calling_Generic_Methods.md @@ -2,6 +2,7 @@ description: Describes how to call generic methods of .NET types in PowerShell Locale: en-US ms.date: 02/02/2022 +online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_calling_generic_methods?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Calling_Generic_Methods --- @@ -9,8 +10,8 @@ title: about_Calling_Generic_Methods Generics let you tailor a method, class, structure, or interface to the precise data type it acts upon. For example, instead of using the - class, which allows keys and values to be -of any type, you can use the +[System.Collections.Hashtable][01] class, which allows keys and values to be +of any type, you can use the [System.Collections.Generic.Dictionary%602][02] generic class and specify the types allowed for the **key** and **value** properties. Generics provide increased code reusability and type safety. @@ -26,8 +27,7 @@ generic method `Empty()` that takes no formal parameters. Prior to PowerShell 7.3, to ensure proper method resolution you had to use complicated workarounds using .NET reflection. For an example, see Lee Holmes' -blog post -[Invoking generic methods on non-generic classes in PowerShell](https://www.leeholmes.com/invoking-generic-methods-on-non-generic-classes-in-powershell/). +blog post [Invoking generic methods on non-generic classes in PowerShell][03]. Beginning with PowerShell 7.3, you can specify the types for a generic method. @@ -53,7 +53,7 @@ types, like `[string, int]`, including other generic types like The `method_arguments` can be zero or more items. -For more information, see [Generics in .NET](/dotnet/standard/generics/). +For more information, see [Generics in .NET][04]. ## Example @@ -88,3 +88,9 @@ The output shows each value raised to the power of 3. 64 125 ``` + + +[01]: xref:System.Collections.Hashtable +[02]: xref:System.Collections.Generic.Dictionary%602 +[03]: https://www.leeholmes.com/invoking-generic-methods-on-non-generic-classes-in-powershell/ +[04]: /dotnet/standard/generics/ diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md index 8704f3494aba..2b6efe24d7ac 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Case-Sensitivity.md @@ -14,35 +14,38 @@ PowerShell is as case-insensitive as possible while preserving case. ## Long description -As a general principle, PowerShell is as case insensitive as possible while preserving case and not -breaking the underlying OS. +As a general principle, PowerShell is as case insensitive as possible while +preserving case and not breaking the underlying OS. ### On Unix-based systems -On Unix-based systems, PowerShell is case-sensitive because filesystem manipulation and environment -variables directly affect the underlying operating system and integration with other tools. +On Unix-based systems, PowerShell is case-sensitive because filesystem +manipulation and environment variables directly affect the underlying +operating system and integration with other tools. ## On all systems - PowerShell variables are case-insensitive - Variable names have no interaction between them and the underlying operating system. PowerShell - treats them case-insensitively. + Variable names have no interaction between them and the underlying operating + system. PowerShell treats them case-insensitively. - Module names are case-insensitive (with exceptions) - The _name_ of the module is purely a PowerShell concept and treated case-insensitively. However, there - is a strong mapping to a foldername, which can be case-sensitive in the underlying operating - system. Importing two modules with the same case-insensitive name has the same behavior as + The _name_ of the module is purely a PowerShell concept and treated + case-insensitively. However, there is a strong mapping to a foldername, which + can be case-sensitive in the underlying operating system. Importing two| + modules with the same case-insensitive name has the same behavior as importing two modules with the same name from different paths. - The name of a module is stored in the session state using the case by which it was imported. The - name, as stored in the session state, is used by `Update-Help` when looking for new help files. - The web service that serves the help files for Microsoft uses a case-sensitive filesystem. When - the case of the imported name of the module doesn't match, `Update-Help` can't find the help files - and reports an error. + The name of a module is stored in the session state using the case by which + it was imported. The name, as stored in the session state, is used + `Update-Help` when looking for new help files. + The web service that serves the help files for Microsoft uses a + case-sensitive filesystem. When the case of the imported name of the module + doesn't match, `Update-Help` can't find the help files and reports an error. ## Related links -- [about_Environment_Variables](about_environment_variables.md) +- [about_Environment_Variables](about_Environment_Variables.md) - [Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Character_Encoding.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Character_Encoding.md index 8d29d357cf2a..21fc65b2a70b 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Character_Encoding.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Character_Encoding.md @@ -17,8 +17,7 @@ data. Unicode is a worldwide character-encoding standard. The system uses Unicode exclusively for character and string manipulation. For a detailed description -of all aspects of Unicode, refer to -[The Unicode Standard](https://www.unicode.org/standard/standard.html). +of all aspects of Unicode, refer to [The Unicode Standard][01]. Windows supports Unicode and traditional character sets. Traditional character sets, such as Windows code pages, use 8-bit values or combinations of 8-bit @@ -50,8 +49,7 @@ The following cmdlets have the **Encoding** parameter: The byte-order-mark (BOM) is a _Unicode signature_ in the first few bytes of a file or text stream that indicate which Unicode encoding used for the data. For -more information, see the -[Byte order mark](/globalization/encoding/byte-order-mark) documentation. +more information, see the [Byte order mark][02] documentation. In Windows PowerShell, any Unicode encoding, except `UTF7`, always creates a BOM. PowerShell (v6 and higher) defaults to `utf8NoBOM` for all text output. @@ -93,9 +91,9 @@ In PowerShell 5.1, the **Encoding** parameter supports the following values: - `UTF7` Uses UTF-7. - `UTF8` Uses UTF-8 (with BOM). -In general, Windows PowerShell uses the Unicode -[UTF-16LE](https://wikipedia.org/wiki/UTF-16) encoding by default. However, -the default encoding used by cmdlets in Windows PowerShell is not consistent. +In general, Windows PowerShell uses the Unicode [UTF-16LE][03] encoding by +default. However, the default encoding used by cmdlets in Windows PowerShell +is not consistent. > [!NOTE] > Using any Unicode encoding, except `UTF7`, always creates a BOM. @@ -105,7 +103,7 @@ For cmdlets that write output to files: - `Out-File` and the redirection operators `>` and `>>` create UTF-16LE, which notably differs from `Set-Content` and `Add-Content`. -- `New-ModuleManifest` and `Export-CliXml` also create UTF-16LE files. +- `New-ModuleManifest` and `Export-Clixml` also create UTF-16LE files. - When the target file is empty or doesn't exist, `Set-Content` and `Add-Content` use `Default` encoding. `Default` is the encoding specified by @@ -150,7 +148,7 @@ For cmdlets that read string data in the absence of a BOM: encoding. ANSI is also what the PowerShell engine uses when it reads source code from files. -- `Import-Csv`, `Import-CliXml`, and `Select-String` assume `Utf8` in the +- `Import-Csv`, `Import-Clixml`, and `Select-String` assume `Utf8` in the absence of a BOM. ## Character encoding in PowerShell @@ -176,10 +174,9 @@ PowerShell defaults to `utf8NoBOM` for all output. Beginning with PowerShell 6.2, the **Encoding** parameter also allows numeric IDs of registered code pages (like `-Encoding 1251`) or string names of registered code pages (like `-Encoding "windows-1251"`). For more information, -see the .NET documentation for -[Encoding.CodePage](/dotnet/api/system.text.encoding.codepage). +see the .NET documentation for [Encoding.CodePage][04]. -Starting with PowerShell 7.4, you can use the `Ansi` value for the **Encoding** +Starting with PowerShell 7.4, you can use the `ANSI` value for the **Encoding** parameter to pass the numeric ID for the current culture's ANSI code page without having to specify it manually. @@ -191,8 +188,7 @@ encoding behavior. - `$PSDefaultParameterValues` - `$OutputEncoding` -For more information, see -[about_Preference_Variables](about_Preference_Variables.md). +For more information, see [about_Preference_Variables][05]. Beginning in PowerShell 5.1, the redirection operators (`>` and `>>`) call the `Out-File` cmdlet. Therefore, you can set the default encoding of them using @@ -225,10 +221,17 @@ the output redirection operators and PowerShell cmdlets use to save to files. ## See also -- [about_Preference_Variables](about_Preference_Variables.md) +- [about_Preference_Variables][05] - [Byte order mark](https://wikipedia.org/wiki/Byte_order_mark) - [Code Pages - Win32 apps](/windows/win32/intl/code-pages) -- [Encoding.CodePage](/dotnet/api/system.text.encoding.codepage) +- [Encoding.CodePage][04] - [Introduction to character encoding in .NET](/dotnet/standard/base-types/character-encoding-introduction) -- [The Unicode Standard](https://www.unicode.org/standard/standard.html) -- [UTF-16LE](https://wikipedia.org/wiki/UTF-16) +- [The Unicode Standard][01] +- [UTF-16LE][03] + + +[01]: https://www.unicode.org/standard/standard.html +[02]: /globalization/encoding/byte-order-mark +[03]: https://wikipedia.org/wiki/UTF-16 +[04]: /dotnet/api/system.text.encoding.codepage +[05]: about_Preference_Variables.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_CimSession.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_CimSession.md index 2ee310c6c102..cf1edb78cc66 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_CimSession.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_CimSession.md @@ -36,7 +36,7 @@ If you create a **PSSession** instead of using a CIM session, PowerShell validates connection settings, and then establishes and maintains the connection. If you use CIM sessions, PowerShell does not open a network connection until needed. For more information about PowerShell sessions, see -[about_PSSessions](about_PSSessions.md). +[about_PSSessions][01]. ## When to use a CIM session @@ -57,7 +57,7 @@ Management (WinRM). CIM sessions do not impose the WinRM limits. CIM-based Cmdlet Definition XML (CDXML) cmdlets can be written to use any WMI Provider. All WMI providers use **CimSession** objects. For more information -about CDXML, see [CDXML definition and terms](/previous-versions/windows/desktop/wmi_v2/cdxml-overview). +about CDXML, see [CDXML definition and terms][02]. CDXML cmdlets have an automatic **CimSession** parameter that can take an array of **CimSession** objects. By default, PowerShell limits number of concurrent @@ -67,5 +67,10 @@ understand the **ThrottleLimit**. ## See also -- [about_PSSessions](about_PSSessions.md) -- [New-CimSession](xref:CimCmdlets.New-CimSession) +- [about_PSSessions][01] +- [New-CimSession][03] + + +[01]: about_PSSessions.md +[02]: /previous-versions/windows/desktop/wmi_v2/cdxml-overview +[03]: xref:CimCmdlets.New-CimSession diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md index 7a0f8117c5d6..5f6d3c1ec825 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md @@ -18,8 +18,8 @@ Describes how you can define classes that extend other types. PowerShell classes support _inheritance_, which allows you to define a child class that reuses (inherits), extends, or modifies the behavior of a parent class. The class whose members are inherited is called the _base class_. The -class that inherits the members of the base class is called the _derived -class_. +class that inherits the members of the base class is called the +_derived class_. PowerShell supports single inheritance only. A class can only inherit from a single class. However, inheritance is transitive, which allows you to define an @@ -1496,8 +1496,8 @@ the value of an inherited static property in a class that doesn't override the property might have unintended effects for classes derived from the same base class. -[Example 1][05] shows how -derived classes that inherit, extend, and override the base class properties. +[Example 1][05] shows how derived classes that inherit, extend, and override +the base class properties. ### Deriving from generics diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Methods.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Methods.md index 2d71eddc047b..d1c904136324 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Methods.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Methods.md @@ -800,7 +800,7 @@ PowerShell class methods have the following limitations: [01]: about_Preference_Variables.md [02]: #hidden-methods [03]: #static-methods -[04]: about_functions_advanced_parameters.md#parameter-and-variable-validation-attributes +[04]: about_Functions_Advanced_Parameters.md#parameter-and-variable-validation-attributes [05]: #example-4---static-method-with-overloads [06]: #defining-instance-methods-with-update-typedata [07]: about_Automatic_Variables.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Properties.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Properties.md index c0571948a703..37550205526e 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Properties.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Classes_Properties.md @@ -953,7 +953,7 @@ PowerShell class properties have the following limitations: [06]: /dotnet/csharp/language-reference/builtin-types/default-values [07]: about_Hidden.md [08]: about_Classes_Inheritance.md -[09]: about_functions_advanced_parameters.md#parameter-and-variable-validation-attributes +[09]: about_Functions_Advanced_Parameters.md#parameter-and-variable-validation-attributes [10]: about_Classes.md [11]: about_Classes_Constructors.md [12]: about_Classes_Inheritance.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md index 8bc9cb055ab5..79685b8e41b2 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md @@ -171,7 +171,7 @@ function Get-Function { } The following are valid comment-based help keywords. These keywords can appear in any order in the comment-based help, and they aren't case-sensitive. The -keywords are listed in in this article inthe order that they typically appear +keywords are listed in this article in the order that they typically appear in a help topic. ### .SYNOPSIS diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_CommonParameters.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_CommonParameters.md index 38b7d2d573ce..6ec72eda5175 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_CommonParameters.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_CommonParameters.md @@ -173,8 +173,8 @@ By default, new error messages overwrite error messages that are already stored in the variable. To append the error message to the variable content, put a plus sign (`+`) before the variable name. -For example, the following command creates the `$a` variable and then stores any -errors in it: +For example, the following command creates the `$a` variable and then stores +any errors in it: ```powershell Get-Process -Id 6 -ErrorVariable a @@ -759,7 +759,7 @@ Mode LastWriteTime Length Name [02]: about_Automatic_Variables.md [03]: about_Preference_Variables.md -[05]: about_functions_advanced.md +[05]: about_Functions_Advanced.md [06]: xref:Microsoft.PowerShell.Utility.Write-Progress [07]: xref:System.Management.Automation.ActionPreference [11]: xref:Microsoft.PowerShell.Utility.Write-Debug diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index 2f3f52ba611d..ce56ffa77bc2 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -680,8 +680,8 @@ Examples: More complex examples: ```powershell -$DomainServers = "ContosoDC1","ContosoDC2","ContosoFileServer","ContosoDNS", - "ContosoDHCP","ContosoWSUS" +$DomainServers = "ContosoDC1", "ContosoDC2", "ContosoFileServer", + "ContosoDNS", "ContosoDHCP", "ContosoWSUS" $thisComputer = "ContosoDC2" $DomainServers -contains $thisComputer @@ -731,8 +731,8 @@ The following examples do the same thing that the examples for `-contains` and More complex examples: ```powershell -$DomainServers = "ContosoDC1","ContosoDC2","ContosoFileServer","ContosoDNS", - "ContosoDHCP","ContosoWSUS" +$DomainServers = "ContosoDC1", "ContosoDC2", "ContosoFileServer", + "ContosoDNS", "ContosoDHCP", "ContosoWSUS" $thisComputer = "ContosoDC2" $thisComputer -in $DomainServers diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Continue.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Continue.md index c3c18aa6a123..628366038ecc 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Continue.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Continue.md @@ -88,13 +88,13 @@ is **True** and iteration continues with the second `for` loop at `labelB`. ## Using continue in a switch statement An unlabeled `continue` statement within a `switch` terminates execution of the -current `switch` iteration and transfers control to the top of the `switch` to get -the next input item. +current `switch` iteration and transfers control to the top of the `switch` to +get the next input item. -When there is a single input item `continue` exits the entire `switch` statement. -When the `switch` input is a collection, the `switch` tests each element of the -collection. The `continue` exits the current iteration and the `switch` continues -with the next element. +When there is a single input item `continue` exits the entire `switch` +statement. When the `switch` input is a collection, the `switch` tests each +element of the collection. The `continue` exits the current iteration and the +`switch` continues with the next element. ```powershell switch (1,2,3) { diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Files.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Files.md index 23d070337a2c..ed217d86b0b3 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Files.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Files.md @@ -48,10 +48,10 @@ the commands and variables that can be used. For more information, see [about_Language_Modes][02]. -Originally, localized data files were meant to be used to store string data that -could be translated into other languages. This allowed your scripts to import -the data to provide localized string output in other languages. However, you -aren't limited to storing string data and don't have to use the data for +Originally, localized data files were meant to be used to store string data +that could be translated into other languages. This allowed your scripts to +import the data to provide localized string output in other languages. However, +you aren't limited to storing string data and don't have to use the data for localized output. The data in the file isn't limited to hashtables. It can be in any format diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Sections.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Sections.md index f8fb23b8c315..8c91d7025dd4 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Sections.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Data_Sections.md @@ -98,8 +98,8 @@ DATA -supportedCommand Format-Xml ### Using a `DATA` Section -To use the content of a `DATA` section, assign it to a variable and use variable -notation to access the content. +To use the content of a `DATA` section, assign it to a variable and use +variable notation to access the content. For example, the following `DATA` section contains a `ConvertFrom-StringData` command that converts the here-string into a hash table. The hash table is @@ -173,7 +173,7 @@ A single-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell DATA { - ConvertFrom-StringData -stringdata @' + ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 '@ @@ -184,7 +184,7 @@ A double-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell DATA { - ConvertFrom-StringData -stringdata @" + ConvertFrom-StringData -StringData @" Msg1 = To start, press any key. Msg2 = To exit, type "quit". "@ @@ -195,7 +195,7 @@ A data section that includes a user-written cmdlet that generates data: ```powershell DATA -supportedCommand Format-XML { - Format-Xml -strings string1, string2, string3 + Format-Xml -Strings string1, string2, string3 } ``` diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Debuggers.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Debuggers.md index 425ee44d74ad..7c097cfff68e 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Debuggers.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Debuggers.md @@ -192,7 +192,7 @@ For example, the following command gets the variables in the local (script) scope: ```powershell -Get-Variable -scope 0 +Get-Variable -Scope 0 ``` This is a useful way to see only the variables that you defined in the script @@ -225,17 +225,17 @@ For example: ```powershell function test-cmdlet { begin { - write-output "Begin" + Write-Output "Begin" } process { - write-output "Process" + Write-Output "Process" } end { - write-output "End" + Write-Output "End" } } -C:\PS> Set-PSBreakpoint -command test-cmdlet +C:\PS> Set-PSBreakpoint -Command test-cmdlet C:\PS> test-cmdlet @@ -285,7 +285,7 @@ identifying changes to the prompt: ```powershell Enter-PSSession -Cn localhost -[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6,11,22,25 +[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6, 11, 22, 25 ID Script Line Command Variable Action -- ------ ---- ------- -------- ------ @@ -367,7 +367,7 @@ Start by creating a line breakpoint on the first line of the Test.ps1 script in the current directory. ```powershell -PS C:\ps-test> Set-PSBreakpoint -line 1 -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Line 1 -Script test.ps1 ``` The command returns a **System.Management.Automation.LineBreakpoint** object. @@ -482,7 +482,7 @@ reuse the breakpoint, use the `Disable-PsBreakpoint` cmdlet instead of `Remove-PsBreakpoint`.) ```powershell -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint ``` You can abbreviate this command as: @@ -501,13 +501,13 @@ function delbr { gbp | rbp } Now, create a breakpoint on the `$scriptname` variable. ```powershell -PS C:\ps-test> Set-PSBreakpoint -variable scriptname -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Variable scriptname -Script test.ps1 ``` You can abbreviate the command as: ```powershell -PS C:\ps-test> sbp -v scriptname -s test.ps1 +PS C:\ps-test> sbp -V scriptname -S test.ps1 ``` Now, start the script. The script reaches the variable breakpoint. The default @@ -557,8 +557,8 @@ Have you run a background job today (start-job)? test.ps1:13 "Done $scriptName" ``` -The `StepOver` command executes the function, and it previews the next statement -in the script, which prints the final line. +The `StepOver` command executes the function, and it previews the next +statement in the script, which prints the final line. Use a `Stop` command (`t`) to exit the debugger. The command prompt reverts to the standard command prompt. @@ -571,19 +571,19 @@ To delete the breakpoints, use the `Get-PsBreakpoint` and `Remove-PsBreakpoint` cmdlets. ```powershell -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint ``` Create a new command breakpoint on the `psversion` function. ```powershell -PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 +PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 ``` You can abbreviate this command to: ```powershell -PS C:\ps-test> sbp -c psversion -s test.ps1 +PS C:\ps-test> sbp -C psversion -S test.ps1 ``` Now, run the script. @@ -612,7 +612,7 @@ Windows PowerShell 2.0 Have you run a background job today (start-job)? Done C:\ps-test\test.ps1 -PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint +PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint PS C:\ps-test> ``` @@ -623,9 +623,9 @@ the action, execution doesn't stop. The backtick (`` ` ``) is the line-continuation character. ```powershell -PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 ` --action { add-content "The value of `$scriptName is $scriptName." ` --path action.log} +PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 ` +-Action { Add-Content "The value of `$scriptName is $scriptName." ` +-Path action.log} ``` You can also add actions that set conditions for the breakpoint. In the @@ -634,8 +634,8 @@ policy is set to RemoteSigned, the most restrictive policy that still permits you to run scripts. ```powershell -PS C:\ps-test> Set-PSBreakpoint -script test.ps1 -command psversion ` --action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }} +PS C:\ps-test> Set-PSBreakpoint -Script test.ps1 -Command psversion ` +-Action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }} ``` The `break` keyword in the action directs the debugger to execute the @@ -700,7 +700,7 @@ features that you can use to debug scripts and functions. [01]: /powershell/scripting/dev-cross-plat/vscode/using-vscode#debugging-with-visual-studio-code -[02]: about_prompts.md +[02]: about_Prompts.md [05]: xref:Microsoft.PowerShell.Utility.Disable-PSBreakpoint [06]: xref:Microsoft.PowerShell.Utility.Enable-PSBreakpoint [07]: xref:Microsoft.PowerShell.Utility.Get-PSBreakpoint diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Provider.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Provider.md index 53d37f765fa5..1c34ddb91bfd 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Provider.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Provider.md @@ -26,8 +26,8 @@ Provides access to the Windows environment variables. ## Detailed description -The PowerShell **Environment** provider lets you get, add, change, clear, and delete environment -variables and values in PowerShell. +The PowerShell **Environment** provider lets you get, add, change, clear, and +delete environment variables and values in PowerShell. **Environment** variables are dynamically named variables that describe the environment in which your programs run. Windows and PowerShell use environment @@ -42,19 +42,18 @@ have no child items. The **Environment** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] ## Types exposed by this provider Each environment variable is an instance of the -[System.Collections.DictionaryEntry](/dotnet/api/system.collections.dictionaryentry) -class. The name of the variable is the dictionary key. The value of the -environment variable is the dictionary value. +[System.Collections.DictionaryEntry][07] class. The name of the variable is the +dictionary key. The value of the environment variable is the dictionary value. ## Navigating the Environment drive @@ -75,10 +74,11 @@ Set-Location C: ``` You can also work with the **Environment** provider from any other PowerShell -drive. To reference an environment variable from another location, use the drive name `Env:` in the path. +drive. To reference an environment variable from another location, use the +drive name `Env:` in the path. -The **Environment** provider also exposes environment variables using a variable -prefix of `$env:`. The following command views the contents of the +The **Environment** provider also exposes environment variables using a +variable prefix of `$env:`. The following command views the contents of the **ProgramFiles** environment variable. The `$env:` variable prefix can be used from any PowerShell drive. @@ -94,9 +94,8 @@ session for as long as it is active. > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is -> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][08], `cd` is an alias for [Set-Location][02] and `pwd` is +> an alias for [Get-Location][01]. ## Getting environment variables @@ -203,8 +202,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path` -parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive. +[Get-Help][09] command in a file system drive or use the `-Path` parameter of +[Get-Help][09] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -216,4 +215,16 @@ Get-Help Get-ChildItem -Path env: ## See also -- [about_Providers](about_Providers.md) +- [about_Providers][10] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: /dotnet/api/system.collections.dictionaryentry +[08]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[09]: xref:Microsoft.PowerShell.Core.Get-Help +[10]: about_Providers.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md index 6a960dbdc462..775c085360ea 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Environment_Variables.md @@ -542,7 +542,7 @@ or `NO_COLOR` environment variables. - `dumb` - sets `$Host.UI.SupportsVirtualTerminal = $false` - `xterm-mono` - sets `$PSStyle.OutputRendering = PlainText` - - `xtermm` - sets `$PSStyle.OutputRendering = PlainText` + - `xterm` - sets `$PSStyle.OutputRendering = PlainText` - `NO_COLOR` @@ -563,12 +563,12 @@ or `NO_COLOR` environment variables. [03]: #powershell-environment-variables [04]: about_Environment_Provider.md [05]: about_Execution_Policies.md -[06]: about_preference_variables.md -[07]: about_profiles.md +[06]: about_Preference_Variables.md +[07]: about_Profiles.md [08]: about_PSModulePath.md [09]: about_Telemetry.md [10]: about_Update_Notifications.md -[11]: about_variables.md +[11]: about_Variables.md [12]: https://no-color.org/ [13]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html [14]: xref:PowerShellGet.Install-Module diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Execution_Policies.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Execution_Policies.md index 6b46fbb48221..482fbecca7a1 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Execution_Policies.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Execution_Policies.md @@ -87,9 +87,9 @@ execution policies are as follows: - The default execution policy for Windows client computers. - Permits individual commands, but does not allow scripts. - - Prevents running of all script files, including formatting and configuration - files (`.ps1xml`), module script files (`.psm1`), and PowerShell profiles - (`.ps1`). + - Prevents running of all script files, including formatting and + configuration files (`.ps1xml`), module script files (`.psm1`), and + PowerShell profiles (`.ps1`). - `Undefined` @@ -137,8 +137,8 @@ execution policies are as follows: The **Process** scope only affects the current PowerShell session. The execution policy is saved in the environment variable - `$env:PSExecutionPolicyPreference`, rather than the configuration file. When the - PowerShell session is closed, the variable and value are deleted. + `$env:PSExecutionPolicyPreference`, rather than the configuration file. When + the PowerShell session is closed, the variable and value are deleted. - CurrentUser @@ -201,12 +201,12 @@ To change the PowerShell execution policy on your Windows computer, use the need to restart PowerShell. If you set the execution policy for the scopes **LocalMachine** or the -**CurrentUser**, the change is saved in the configuration file and remains effective -until you change it again. +**CurrentUser**, the change is saved in the configuration file and remains +effective until you change it again. If you set the execution policy for the **Process** scope, it's not saved in -the configuration file. The execution policy is retained until the current process and -any child processes are closed. +the configuration file. The execution policy is retained until the current +process and any child processes are closed. > [!NOTE] > In Windows Vista and later versions of Windows, to run commands that @@ -280,15 +280,15 @@ For example: pwsh.exe -ExecutionPolicy AllSigned ``` -The execution policy that you set isn't stored in the configuration file. Instead, it's -stored in the `$env:PSExecutionPolicyPreference` environment variable. The -variable is deleted when you close the session in which the policy is set. You -cannot change the policy by editing the variable value. +The execution policy that you set isn't stored in the configuration file. +Instead, it's stored in the `$env:PSExecutionPolicyPreference` environment +variable. The variable is deleted when you close the session in which the +policy is set. You cannot change the policy by editing the variable value. During the session, the execution policy that is set for the session takes -precedence over an execution policy that is set in the configuration file for the local -computer or current user. However, it doesn't take precedence over the -execution policy set by using a Group Policy. +precedence over an execution policy that is set in the configuration file for +the local computer or current user. However, it doesn't take precedence over +the execution policy set by using a Group Policy. ## Use Group Policy to Manage Execution Policy @@ -359,8 +359,7 @@ Beginning in PowerShell 3.0, you can use the **Stream** parameter of the from the internet. Use the `Unblock-File` cmdlet to unblock the scripts so that you can run them in PowerShell. -For more information, see [about_Signing][04], -[Get-Item][05], and +For more information, see [about_Signing][04], [Get-Item][05], and [Unblock-File][08]. > [!NOTE] @@ -411,7 +410,7 @@ Zone check which avoids the problem. [01]: about_Environment_Variables.md [02]: about_Group_Policy_Settings.md -[03]: about_pwsh.md +[03]: about_Pwsh.md [04]: about_Signing.md [05]: xref:Microsoft.PowerShell.Management.Get-Item [06]: xref:Microsoft.PowerShell.Security.Get-ExecutionPolicy diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md index 125c05ebdaa2..387cc789132d 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md @@ -125,8 +125,8 @@ public class InvokeWebRequestCommandV2 : WebCmdletBaseV2 { ... } public class InvokeWebRequestCommand : WebCmdletBase { ... } ``` -When the `MyWebCmdlets.PSWebCmdletV2` experimental feature is enabled, the existing -`InvokeWebRequestCommand` implementation is hidden and the +When the `MyWebCmdlets.PSWebCmdletV2` experimental feature is enabled, the +existing `InvokeWebRequestCommand` implementation is hidden and the `InvokeWebRequestCommandV2` provides the implementation of `Invoke-WebRequest`. diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md index 89634f417142..ef1808b95671 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md @@ -547,9 +547,10 @@ non-hidden items. The **Hidden** parameter was introduced in Windows PowerShell 3.0. -To get only hidden items, use the **Hidden** parameter, its `h` or `ah` aliases, -or the **Hidden** value of the **Attributes** parameter. To exclude hidden -items, omit the **Hidden** parameter or use the **Attributes** parameter. +To get only hidden items, use the **Hidden** parameter, its `h` or `ah` +aliases, or the **Hidden** value of the **Attributes** parameter. To exclude +hidden items, omit the **Hidden** parameter or use the **Attributes** +parameter. #### Cmdlets supported @@ -681,7 +682,7 @@ Get-Help Get-ChildItem -Path c: - [about_Providers][08] - + [01]: /dotnet/api/system.datetime [02]: /dotnet/api/system.io.directoryinfo [03]: /dotnet/api/system.io.fileattributes diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_For.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_For.md index c0094c5c98bd..582995913de0 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_For.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_For.md @@ -118,7 +118,7 @@ for (($i = 0), ($j = 0); $i -lt 10 -and $j -lt 10; $i++,$j++) } ``` -For more information, see [about_Logical_Operators](about_Logical_Operators.md). +For more information, see [about_Logical_Operators][01]. ### Syntax examples @@ -225,7 +225,7 @@ for ($i = 0; $i -le 20; $i += 2) The `For` loop can also be written on one line as in the following example. ```powershell -for ($i = 0; $i -lt 10; $i++) { Write-Host $i } +for ($i = 0; $i -lt 10; $i++){Write-Host $i} ``` ### Functional example @@ -356,7 +356,7 @@ properties: index. ```powershell -$paddedList = Get-ChildItem -path ./work_items +$paddedList = Get-ChildItem -Path ./work_items # Sort both file lists by name. $sortedOriginal = $fileList | Sort-Object -Property Name @@ -406,5 +406,10 @@ In the output, the sorted work items after padding are in the expected order. ## See also -- [about_Comparison_Operators](about_Comparison_Operators.md) -- [about_Foreach](about_Foreach.md) +- [about_Comparison_Operators][02] +- [about_Foreach][03] + + +[01]: about_Logical_Operators.md +[02]: about_Comparison_Operators.md +[03]: about_Foreach.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Foreach.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Foreach.md index 2d4c0f5b69c6..79808c238427 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Foreach.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Foreach.md @@ -105,8 +105,8 @@ counts files over 100 KB in size: ```powershell $i = 0 foreach ($file in Get-ChildItem) { - if ($file.length -gt 100KB) { - Write-Host $file 'file size:' ($file.length / 1024).ToString('F0') KB + if ($file.Length -gt 100KB) { + Write-Host $file 'file size:' ($file.Length / 1024).ToString('F0') KB $i = $i + 1 } } @@ -128,7 +128,7 @@ display a count of files over 100KB. The previous example also demonstrates how to format the file length results: ```powershell -($file.length / 1024).ToString('F0') +($file.Length / 1024).ToString('F0') ``` The value is divided by 1,024 to show the results in kilobytes rather than diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md index 9287098b388a..83af3b82ba27 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Format.ps1xml.md @@ -65,10 +65,9 @@ new objects, create your own `Format.ps1xml` files, and then add them to your PowerShell session. To create a `Format.ps1xml` file to define a custom view, use the -[Get-FormatData](xref:Microsoft.PowerShell.Utility.Get-FormatData) and -[Export-FormatData](xref:Microsoft.PowerShell.Utility.Export-FormatData) -cmdlets. Use a text editor to edit the file. The file can be saved to any -directory that PowerShell can access, such as a subdirectory of `$HOME`. +[Get-FormatData][01] and [Export-FormatData][02] cmdlets. Use a text editor to +edit the file. The file can be saved to any directory that PowerShell can +access, such as a subdirectory of `$HOME`. To change the formatting of a current view, locate the view in the formatting file, and then use the tags to change the view. To create a view for a new @@ -76,13 +75,12 @@ object type, create a new view, or use an existing view as a model. The tags are described in the next section. You can then delete all the other views in the file so that the changes are obvious to anyone examining the file. -After you save the changes, use the -[Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData) to -add the new file to your PowerShell session. If you want your view to take -precedence over a view defined in the built-in files, use the **PrependPath** -parameter. `Update-FormatData` affects only the current session. To make the -change to all future sessions, add the `Update-FormatData` command to your -PowerShell profile. +After you save the changes, use the [Update-FormatData][03] to add the new file +to your PowerShell session. If you want your view to take precedence over a +view defined in the built-in files, use the **PrependPath** parameter. +`Update-FormatData` affects only the current session. To make the change to +all future sessions, add the `Update-FormatData` command to your PowerShell +profile. ### Example: Add calendar data to culture objects @@ -193,7 +191,7 @@ the current PowerShell session. This example uses the **PrependPath** parameter to place the new file in a higher precedence order than the original file. For more information, see -[Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData). +[Update-FormatData][03]. ```powershell Update-FormatData -PrependPath $HOME\Format\CultureInfo.Format.ps1xml @@ -214,8 +212,8 @@ LCID Name Calendar DisplayName ## The XML in Format.ps1xml files -The full schema definition can be found in [Format.xsd](https://github.com/PowerShell/PowerShell/blob/master/src/Schemas/Format.xsd) -in the PowerShell source code repository on GitHub. +The full schema definition can be found in [Format.xsd][04] in the PowerShell +source code repository on GitHub. The **ViewDefinitions** section of each `Format.ps1xml` file contains the `` tags that define each view. A typical `` tag includes the @@ -284,9 +282,9 @@ The `` tag typically contains a `` tag. The contains one `` tag. A `` tag must include either a `` tag or a -`` tag. A `` tag specifies the property to display at -the specified location in the view. A `` tag specifies a script to -evaluate and display at the specified location in the view. +`` tag. A `` tag specifies the property to display +at the specified location in the view. A `` tag specifies a script +to evaluate and display at the specified location in the view. A `` tag can contain a `` tag that specifies how to display the property. @@ -309,15 +307,12 @@ value of the **Name** parameter: - FormatFileLoading - FormatViewBinding -For more information, see -[Trace-Command](xref:Microsoft.PowerShell.Utility.Trace-Command) and -[Get-TraceSource](xref:Microsoft.PowerShell.Utility.Get-TraceSource). +For more information, see [Trace-Command][05] and [Get-TraceSource][06]. ## Signing a Format.ps1xml file To protect the users of your `Format.ps1xml` file, sign the file using a -digital signature. For more information, see -[about_Signing](about_Signing.md). +digital signature. For more information, see [about_Signing][07]. ## Sample XML for a Format-Table custom view @@ -341,8 +336,7 @@ For this example, the custom view must use the table format, otherwise, Use `Format-Table` with the **View** parameter to specify the custom view's name, **mygciview**, and format the table's output with the **CreationTime** -column. For an example of how the command is run, see -[Format-Table](xref:Microsoft.PowerShell.Utility.Format-Table). +column. For an example of how the command is run, see [Format-Table][08]. > [!NOTE] > Although you can get the formatting XML from the source code to create a @@ -429,10 +423,22 @@ Update-FormatData -AppendPath ./Mygciview.Format.ps1xml ## See also -- [Trace-Command](xref:Microsoft.PowerShell.Utility.Trace-Command) -- [Export-FormatData](xref:Microsoft.PowerShell.Utility.Export-FormatData) -- [Get-FormatData](xref:Microsoft.PowerShell.Utility.Get-FormatData) -- [Update-FormatData](xref:Microsoft.PowerShell.Utility.Update-FormatData) -- [Get-TraceSource](xref:Microsoft.PowerShell.Utility.Get-TraceSource) -- [Format Schema XML Reference](/powershell/scripting/developer/format/format-schema-xml-reference) -- [Writing a PowerShell Formatting File](/powershell/scripting/developer/format/writing-a-powershell-formatting-file) +- [Trace-Command][05] +- [Export-FormatData][02] +- [Get-FormatData][01] +- [Update-FormatData][03] +- [Get-TraceSource][06] +- [Format Schema XML Reference][09] +- [Writing a PowerShell Formatting File][10] + + +[01]: xref:Microsoft.PowerShell.Utility.Get-FormatData +[02]: xref:Microsoft.PowerShell.Utility.Export-FormatData +[03]: xref:Microsoft.PowerShell.Utility.Update-FormatData +[04]: https://github.com/PowerShell/PowerShell/blob/master/src/Schemas/Format.xsd +[05]: xref:Microsoft.PowerShell.Utility.Trace-Command +[06]: xref:Microsoft.PowerShell.Utility.Get-TraceSource +[07]: about_Signing.md +[08]: xref:Microsoft.PowerShell.Utility.Format-Table +[09]: /powershell/scripting/developer/format/format-schema-xml-reference +[10]: /powershell/scripting/developer/format/writing-a-powershell-formatting-file diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Function_Provider.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Function_Provider.md index c9beb358674a..21cc8f222ccf 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Function_Provider.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Function_Provider.md @@ -40,20 +40,18 @@ and filter objects. Neither functions nor filters have child items. The **Function** provider supports the following cmdlets, which are covered in this article. -- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location) -- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location) -- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item) -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) -- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item) -- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item) +- [Get-Location][01] +- [Set-Location][02] +- [Get-Item][03] +- [New-Item][04] +- [Remove-Item][05] +- [Clear-Item][06] ## Types exposed by this provider Each function is an instance of the -[System.Management.Automation.FunctionInfo](/dotnet/api/system.management.automation.functioninfo) -class. Each filter is an instance of the -[System.Management.Automation.FilterInfo](/dotnet/api/system.management.automation.filterinfo) -class. +[System.Management.Automation.FunctionInfo][07] class. Each filter is an +instance of the [System.Management.Automation.FilterInfo][08] class. ## Navigating the Function drive @@ -80,9 +78,8 @@ drive. To reference a function from another location, use the drive name > [!NOTE] > PowerShell uses aliases to allow you a familiar way to work with provider > paths. Commands such as `dir` and `ls` are now aliases for -> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem), -> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is -> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location). +> [Get-ChildItem][09], `cd` is an alias for [Set-Location][10] and `pwd` is +> an alias for [Get-Location][01]. ## Getting functions @@ -223,9 +220,9 @@ Determines the value of the **Options** property of a function. ### Cmdlets supported -- [New-Item](xref:Microsoft.PowerShell.Management.New-Item) +- [New-Item][04] -- [Set-Item](xref:Microsoft.PowerShell.Management.Set-Item) +- [Set-Item][11] ## Using the pipeline @@ -240,8 +237,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for provider cmdlets that explain how those cmdlets behave in a file system drive. To get the help topics that are customized for the file system drive, run a -[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path` -parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive. +[Get-Help][12] command in a file system drive or use the `-Path` parameter of +[Get-Help][12] to specify a file system drive. ```powershell Get-Help Get-ChildItem @@ -253,5 +250,21 @@ Get-Help Get-ChildItem -Path function: ## See also -- [about_Functions](about_Functions.md) -- [about_Providers](about_Providers.md) +- [about_Functions][13] +- [about_Providers][14] + + +[01]: xref:Microsoft.PowerShell.Management.Get-Location +[02]: xref:Microsoft.PowerShell.Management.Set-Location +[03]: xref:Microsoft.PowerShell.Management.Get-Item +[04]: xref:Microsoft.PowerShell.Management.New-Item +[05]: xref:Microsoft.PowerShell.Management.Remove-Item +[06]: xref:Microsoft.PowerShell.Management.Clear-Item +[07]: /dotnet/api/system.management.automation.functioninfo +[08]: /dotnet/api/system.management.automation.filterinfo +[09]: xref:Microsoft.PowerShell.Management.Get-ChildItem +[10]: xref:Microsoft.PowerShell.Management.Set-Location +[11]: xref:Microsoft.PowerShell.Management.Set-Item +[12]: xref:Microsoft.PowerShell.Core.Get-Help +[13]: about_Functions.md +[14]: about_Providers.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md index 9b2074079b21..4b08f233aae5 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md @@ -1,7 +1,7 @@ --- description: Describes how to create and use functions in PowerShell. Locale: en-US -ms.date: 06/10/2024 +ms.date: 06/26/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Functions @@ -303,8 +303,8 @@ function Get-SmallFiles { } ``` -In the function, you can use the `$Size` variable, which is the name defined for -the parameter. +In the function, you can use the `$Size` variable, which is the name defined +for the parameter. To use this function, type the following command: @@ -494,7 +494,7 @@ function Get-Pipeline process {"The value is: $_"} } -1,2,4 | Get-Pipeline +1, 2, 4 | Get-Pipeline ``` ```Output @@ -527,9 +527,9 @@ function Get-SumOfNumbers { end { $retValue } } -PS> 1,2,3,4 | Get-SumOfNumbers +PS> 1, 2, 3, 4 | Get-SumOfNumbers 10 -PS> Get-SumOfNumbers 1,2,3,4 +PS> Get-SumOfNumbers 1, 2, 3, 4 10 ``` @@ -553,7 +553,7 @@ If this function is run using the pipeline, it displays the following results: ```powershell -1,2,4 | Get-PipelineBeginEnd +1, 2, 4 | Get-PipelineBeginEnd ``` ```Output @@ -582,7 +582,7 @@ object at a time. The `$input` automatic variable is empty when the function reaches the `end` keyword. ```powershell -1,2,4 | Get-PipelineInput +1, 2, 4 | Get-PipelineInput ``` ```Output @@ -771,7 +771,7 @@ You can write help for a function using either of the two following methods: [05]: about_Automatic_Variables.md [06]: about_Automatic_Variables.md#using-enumerators [07]: about_Comment_Based_Help.md -[08]: about_Function_provider.md +[08]: about_Function_Provider.md [09]: about_Functions_Advanced_Methods.md [10]: about_Functions_Advanced_Parameters.md [11]: about_Functions_Advanced.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md index 2adff162ae81..99d317d26910 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced.md @@ -9,6 +9,7 @@ title: about_Functions_Advanced # about_Functions_Advanced ## Short description + Introduces advanced functions that are a way to create cmdlets using scripts. ## Long description @@ -45,7 +46,7 @@ function Send-Greeting [CmdletBinding()] param( [Parameter(Mandatory=$true)] - [string] $Name + [string]$Name ) process diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md index f53a4fae17f9..446a169b63d7 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md @@ -121,7 +121,7 @@ function Get-SumOfNumbers { end { $retValue } } -PS> Get-SumOfNumbers 1,2,3,4 +PS> Get-SumOfNumbers 1, 2, 3, 4 10 PS> 1,2,3,4 | Get-SumOfNumbers 10 diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md index d8c9663d6925..3de1a83971e5 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md @@ -585,7 +585,7 @@ function Test-Remainder { "${i}: $($Remaining[$i])" } } -Test-Remainder first one,two +Test-Remainder first one, two ``` ```Output @@ -1351,7 +1351,7 @@ This attribute was added in PowerShell 6.1.1. - [about_Functions_OutputTypeAttribute][13] -[01]: about_comment_based_help.md +[01]: about_Comment_Based_Help.md [02]: /dotnet/api/system.management.automation.runtimedefinedparameter [03]: /dotnet/standard/base-types/composite-formatting#composite-format-string [04]: /dotnet/standard/base-types/composite-formatting#format-string-component diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md index a691fe5d7386..1a11ad910bf7 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Argument_Completion.md @@ -40,8 +40,7 @@ example, the value of the **Fruit** parameter can only be **Apple**, Param( [Parameter(Mandatory=$true)] [ValidateSet('Apple', 'Banana', 'Pear')] - [string[]] - $Fruit + [string[]]$Fruit ) ``` @@ -51,7 +50,7 @@ be used on any variable, not just parameters. ```powershell [ValidateSet('Chocolate', 'Strawberry', 'Vanilla')] -[string]$flavor = 'Strawberry' +[string]$Flavor = 'Strawberry' ``` The validation occurs whenever that variable is assigned even within the diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md index 28500d557928..d36d9df68ca7 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Group_Policy_Settings.md @@ -93,7 +93,8 @@ User Configuration\ > These **PowerShell Core Administrative Templates** don't include settings > for Windows PowerShell. For more information about acquiring other templates > and configuring Group policy, see -> [How to create and manage the Central Store for Group Policy Administrative Templates in Windows][gpstore]. +> [How to create and manage the Central Store for Group Policy Administrative +> Templates in Windows][gpstore]. ## Console session configuration diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Hash_Tables.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Hash_Tables.md index 30d63ccbae39..19adf00422b6 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Hash_Tables.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Hash_Tables.md @@ -10,6 +10,7 @@ title: about_Hash_Tables # about_Hash_Tables ## Short description + Describes how to create, use, and sort hashtables in PowerShell. ## Long description @@ -314,9 +315,9 @@ member notation or array index notation. ### Handling property name collisions If the key name collides with one of the property names of the **HashTable** -type, you can use the **psbase** [intrinsic member](about_Intrinsic_Members.md) -to access those properties. For example, if the key name is `keys` and you want -to return the collection of the **HashTable** keys, use this syntax: +type, you can use the **psbase** [intrinsic member][01] to access those +properties. For example, if the key name is `keys` and you want to return the +collection of the **HashTable** keys, use this syntax: ```powershell $hashtable.psbase.Keys @@ -332,7 +333,7 @@ ways. Each of the examples in this section has identical output. They iterate over the `$hash` variable defined here: ```powershell -$hash = [ordered]@{ Number = 1; Shape = "Square"; Color = "Blue"} +$hash = [ordered]@{Number = 1; Shape = "Square"; Color = "Blue"} ``` > [!NOTE] @@ -476,7 +477,7 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 441 24 54196 54012 571 5.10 1788 PowerShell -PS> $p.keys | ForEach-Object {$p.$_.handles} +PS> $p.Keys | ForEach-Object {$p.$_.Handles} 441 251 ``` @@ -504,7 +505,7 @@ PowerShell System.Diagnostics.Process (PowerShell) Notepad System.Diagnostics.Process (notepad) System.ServiceProcess.Servi... Running -PS> $p.keys +PS> $p.Keys PowerShell Notepad @@ -512,7 +513,7 @@ Status Name DisplayName ------ ---- ----------- Running winrm Windows Remote Management (WS-Manag... -PS> $p.keys | ForEach-Object {$_.name} +PS> $p.Keys | ForEach-Object {$_.Name} WinRM ``` @@ -605,7 +606,7 @@ The syntax is as follows: This method works only for classes that have a constructor that has no parameters. The object properties must be public and settable. -For more information, see [about_Object_Creation](about_Object_Creation.md). +For more information, see [about_Object_Creation][02]. ## ConvertFrom-StringData @@ -617,7 +618,7 @@ cmdlet safely in the Data section of a script, and you can use it with the Here-strings are especially useful when the values in the hashtable include quotation marks. For more information about here-strings, see -[about_Quoting_Rules](about_Quoting_Rules.md). +[about_Quoting_Rules][03]. The following example shows how to create a here-string of the user messages in the previous example and how to use `ConvertFrom-StringData` to convert them @@ -647,16 +648,25 @@ Msg2 She said, "Hello, World." Msg1 Type "Windows". ``` -For more information about here-strings, see -[about_Quoting_Rules](about_Quoting_Rules.md). +For more information about here-strings, see [about_Quoting_Rules][03]. ## See also -- [about_Arrays](about_Arrays.md) -- [about_Intrinsic_Members](about_Intrinsic_Members.md) -- [about_Object_Creation](about_Object_Creation.md) -- [about_Quoting_Rules](about_Quoting_Rules.md) -- [about_Script_Internationalization](about_Script_Internationalization.md) -- [Import-LocalizedData](xref:Microsoft.PowerShell.Utility.Import-LocalizedData) -- [ConvertFrom-StringData](xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData) -- [System.Collections.Hashtable](/dotnet/api/system.collections.hashtable) +- [about_Arrays][04] +- [about_Intrinsic_Members][01] +- [about_Object_Creation][02] +- [about_Quoting_Rules][03] +- [about_Script_Internationalization][05] +- [Import-LocalizedData][06] +- [ConvertFrom-StringData][07] +- [System.Collections.Hashtable][08] + + +[01]: about_Intrinsic_Members.md +[02]: about_Object_Creation.md +[03]: about_Quoting_Rules.md +[04]: about_Arrays.md +[05]: about_Script_Internationalization.md +[06]: xref:Microsoft.PowerShell.Utility.Import-LocalizedData +[07]: xref:Microsoft.PowerShell.Utility.ConvertFrom-StringData +[08]: /dotnet/api/system.collections.hashtable diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Hidden.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Hidden.md index 3f208f51592a..fde36ceb54b3 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Hidden.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Hidden.md @@ -17,9 +17,9 @@ Describes the `hidden` keyword, which hides class members from default When you use the `hidden` keyword in a script, you hide the members of a class by default. Hidden members do not display in the default results of the -`Get-Member` cmdlet, IntelliSense, or tab completion results. To display members -that you have hidden with the `hidden` keyword, add the **Force** parameter to a -`Get-Member` command. +`Get-Member` cmdlet, IntelliSense, or tab completion results. To display +members that you have hidden with the `hidden` keyword, add the **Force** +parameter to a `Get-Member` command. The `hidden` keyword can hide: @@ -48,11 +48,12 @@ PowerShell 5.0. ## EXAMPLE The following example shows how to use the `hidden` keyword in a class -definition. The **Car** class method, **Drive**, has a property, **rides**, that -does not need to be viewed or changed as it merely tallies the number of times -that **Drive** is called on the **Car** class. That metric that is not important -to users of the class (consider, for example, that when you are buying a car, -you do not ask the seller on how many drives the car has been taken). +definition. The **Car** class method, **Drive**, has a property, **rides**, +that does not need to be viewed or changed as it merely tallies the number of +times that **Drive** is called on the **Car** class. That metric that is not +important to users of the class (consider, for example, that when you are +buying a car, you do not ask the seller on how many drives the car has been +taken). Because there is little need for users of the class to change this property, we can hide the property from `Get-Member` and automatic completion results by @@ -114,8 +115,8 @@ ModelYear Property string ModelYear {get;set;} ``` Now, try running `Get-Member` again, but this time, add the `-Force` parameter. -Note that the results contain the hidden **rides** property, among other members -that are hidden by default. +Note that the results contain the hidden **rides** property, among other +members that are hidden by default. ```output PS C:\Windows\system32> $TestCar | Get-Member -Force diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_History.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_History.md index 7eadcc6223ac..13d9cc281739 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_History.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_History.md @@ -29,13 +29,13 @@ The PSReadLine history tracks the commands used in all PowerShell sessions. The history is written to a central file per host. That history file is available to all sessions and contains all past history. The history is not deleted when the session ends. Also, that history cannot be managed by the -`*-History` cmdlets. For more information, see -[about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md). +`*-History` cmdlets. For more information, see [about_PSReadLine][01]. ## Using the built-in session history The built-in history only tracks the commands used in the current session. The -history is not available to other sessions and is deleted when the session ends. +history is not available to other sessions and is deleted when the session +ends. ### History Cmdlets @@ -72,7 +72,7 @@ command history. > module. PSReadLine loads automatically when you start a PowerShell session. > With PSReadLine loaded, F7 and F9 are not bound to any > function. PSReadLine does not provide equivalent functionality. For more -> information, see [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md). +> information, see [about_PSReadLine][01]. ### MaximumHistoryCount @@ -91,10 +91,10 @@ To apply the setting, restart PowerShell. To save the new variable value for all your PowerShell sessions, add the assignment statement to a PowerShell profile. For more information about -profiles, see [about_Profiles](about_Profiles.md). +profiles, see [about_Profiles][02]. For more information about the `$MaximumHistoryCount` preference variable, see -[about_Preference_Variables](about_Preference_Variables.md). +[about_Preference_Variables][03]. ### Order of Commands in the History @@ -106,8 +106,15 @@ completed only when you exit the prompt level. ## See also -- [about_Line_Editing](about_Line_Editing.md) -- [about_Preference_Variables](about_Preference_Variables.md) -- [about_Profiles](about_Profiles.md) -- [about_PSReadLine](../../PSReadLine/About/about_PSReadLine.md) -- [about_Variables](about_Variables.md) +- [about_Line_Editing][04] +- [about_Preference_Variables][03] +- [about_Profiles][02] +- [about_PSReadLine][01] +- [about_Variables][05] + + +[01]: ../../PSReadLine/About/about_PSReadLine.md +[02]: about_Profiles.md +[03]: about_Preference_Variables.md +[04]: about_Line_Editing.md +[05]: about_Variables.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Job_Details.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Job_Details.md index ae25c6d7bf47..85ccd4b72c69 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Job_Details.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Job_Details.md @@ -145,14 +145,15 @@ start the job. - When you use `Start-Job` to start a job on a local computer, the job consists of an executive parent job and a child job that runs the command. -- When you use the **AsJob** parameter of `Invoke-Command` to start a job on one or - more computers, the job consists of an executive parent job and a child job - for each job run on each computer. +- When you use the **AsJob** parameter of `Invoke-Command` to start a job on + one or more computers, the job consists of an executive parent job and a + child job for each job run on each computer. -- When you use `Invoke-Command` to run a `Start-Job` command on one or more remote - computers, the result is the same as a local command run on each remote - computer. The command returns a job object for each computer. The job object - consists of an executive parent job and one child job that runs the command. +- When you use `Invoke-Command` to run a `Start-Job` command on one or more + remote computers, the result is the same as a local command run on each + remote computer. The command returns a job object for each computer. The job + object consists of an executive parent job and one child job that runs the + command. The parent job represents all of the child jobs. When you manage a parent job, you also manage the associated child jobs. For example, if you stop a parent @@ -239,10 +240,10 @@ exist only in a particular session. Workflow jobs can be suspended and resumed. The cmdlets that you use to manage custom jobs depend on the job type. For -some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. Others -come with specialized cmdlets that manage only a particular type of job. For -detailed information about custom job types, see the help topics about the job -type. +some, you use the standard job cmdlets, such as `Get-Job` and `Start-Job`. +Others come with specialized cmdlets that manage only a particular type of job. +For detailed information about custom job types, see the help topics about the +job type. To find the job type of a job, use the `Get-Job` cmdlet. `Get-Job` returns different job objects for different types of jobs. The value of the @@ -265,9 +266,10 @@ The following table lists the job types that come with PowerShell. | PSEventJob | Created using`Register-ObjectEvent` and specifying an | | | action with the **Action** parameter. | -NOTE: Before using the `Get-Job` cmdlet to get jobs of a particular type, verify -that the module that adds the job type is imported into the current session. -Otherwise, `Get-Job` does not get jobs of that type. +> [!NOTE] +> Before using the `Get-Job` cmdlet to get jobs of a particular type, verify +> that the module that adds the job type is imported into the current session. +> Otherwise, `Get-Job` does not get jobs of that type. ## Examples @@ -354,7 +356,7 @@ Id Name JobTriggers Command Enabled - [about_Jobs](about_Jobs.md) - [about_Remote](about_Remote.md) - [about_Remote_Jobs](about_Remote_Jobs.md) -- [about_Thread_Jobs](/powershell/module/microsoft.powershell.core/about/about_Thread_Jobs) +- [about_Thread_Jobs](about_Thread_Jobs.md) - [Invoke-Command](xref:Microsoft.PowerShell.Core.Invoke-Command) - [Get-Job](xref:Microsoft.PowerShell.Core.Get-Job) - [Remove-Job](xref:Microsoft.PowerShell.Core.Remove-Job) diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Join.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Join.md index 0de5e0bfa8e7..770e6a05ec2c 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Join.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Join.md @@ -24,8 +24,8 @@ in the command. The following diagram shows the syntax for the join operator. ```powershell --Join - -Join +-join + -join ``` #### Parameters diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Keywords.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Keywords.md index dd9e6f64d070..8ceb12511d52 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Keywords.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Keywords.md @@ -184,8 +184,8 @@ do {} until () ## `dynamicparam` -Specifies one part of the body of a function, along with the `begin`, `process`, -and `end` keywords. Dynamic parameters are added at runtime. +Specifies one part of the body of a function, along with the `begin`, +`process`, and `end` keywords. Dynamic parameters are added at runtime. Syntax: @@ -284,7 +284,7 @@ value of the `%ERRORLEVEL%` environment variable. Any argument that is non-numeric or outside the platform-specific range is translated to the value of `0`. -In the following example, the user sets the error level variable value to **4** +In the following example, the user sets the error level variable value to `4` by adding `exit 4` to the script file `test.ps1`. ```cmd diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Modes.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Modes.md index 4cdb9b135f73..846cf65c393f 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Modes.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Language_Modes.md @@ -339,7 +339,7 @@ Beginning in PowerShell 7.2, the `New-Object` cmdlet is disabled in [01]: /powershell/scripting/learn/remoting/jea/session-configurations -[02]: about_member-access_enumeration.md +[02]: about_Member-Access_Enumeration.md [03]: about_Session_Configuration_Files.md [04]: about_Session_Configurations.md [05]: xref:Microsoft.PowerShell.Core.New-PSSessionConfigurationFile diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md index 13f66094e7f9..ac486da9b026 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Non-Windows.md @@ -295,11 +295,11 @@ To view PowerShell log data from a command line on macOS, use the `log` command in the **Terminal** or other shell host application. These commands can be run from **PowerShell**, **Z Shell**, or **Bash**. -In the following example, the `log` command is used to show the log data on your -system as it's occurring in realtime. The **process** parameter filters the log -data for only the `pwsh` process. If you have more than one instance of `pwsh` -running, the **process** parameter also accepts a process ID as its value. The -**level** parameter shows messages at the specified level and below. +In the following example, the `log` command is used to show the log data on +your system as it's occurring in realtime. The **process** parameter filters +the log data for only the `pwsh` process. If you have more than one instance of +`pwsh` running, the **process** parameter also accepts a process ID as its +value. The **level** parameter shows messages at the specified level and below. ```powershell log stream --predicate "subsystem == 'com.microsoft.powershell'" --level info diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Windows.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Windows.md index c45c5cf22010..53c23d1880d4 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Windows.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Logging_Windows.md @@ -203,8 +203,7 @@ private key: ```powershell Get-WinEvent Microsoft-Windows-PowerShell/Operational | - Where-Object Id -eq 4104 | - Unprotect-CmsMessage + Where-Object Id -eq 4104 | Unprotect-CmsMessage ``` ## See also diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md index 805ba5e59a4d..2d06efddd97d 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Member-Access_Enumeration.md @@ -57,8 +57,8 @@ During member-access enumeration for a property, the operator returns the value of the property for each item that has that property. If no items have the specified property, the operator returns `$null`. -During member-access enumeration for a method, the operator attempts to call the -method on each item in the collection. If any item in the collection does +During member-access enumeration for a method, the operator attempts to call +the method on each item in the collection. If any item in the collection does not have the specified method, the operator returns the **MethodNotFound** exception. @@ -333,7 +333,7 @@ in the array. ### Collections containing PSCustomObject instances If the collection of objects contains instances of **PSCustomObject** items, -PowerShell unexpectedly retruns `$null` values when the accessed property is +PowerShell unexpectedly returns `$null` values when the accessed property is missing. In the following examples at least one object has the referenced property. diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Methods.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Methods.md index a446c0c961b1..c54efe25d23d 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Methods.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Methods.md @@ -115,8 +115,8 @@ two method signatures: ``` The first method signature takes the destination file name (and a path). The -following example uses the first `CopyTo` method to copy the `Final.txt` file to -the `C:\Bin` directory. +following example uses the first `CopyTo` method to copy the `Final.txt` file +to the `C:\Bin` directory. ```powershell (Get-ChildItem c:\final.txt).CopyTo("c:\bin\final.txt") diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Module_Manifests.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Module_Manifests.md index afe794a2a02b..69ffc2c80cce 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Module_Manifests.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Module_Manifests.md @@ -1559,10 +1559,10 @@ imported as `Get-ExampleItem`. [03]: /powershell/gallery/concepts/package-manifest-affecting-ui [04]: /powershell/scripting/dev-cross-plat/performance/module-authoring-considerations [05]: /powershell/scripting/developer/module/supporting-updatable-help -[06]: about_experimental_features.md#declaring-experimental-features-in-modules-written-in-powershell +[06]: about_Experimental_Features.md#declaring-experimental-features-in-modules-written-in-powershell [07]: about_Format.ps1xml.md [08]: about_Language_Modes.md -[09]: about_powershell_editions.md +[09]: about_Powershell_Editions.md [10]: about_Types.ps1xml.md [11]: about_Updatable_Help.md [13]: xref:Microsoft.PowerShell.Core.New-ModuleManifest diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Modules.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Modules.md index 702c603f31a4..cf8136ffaa46 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Modules.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Modules.md @@ -248,8 +248,7 @@ For example, to find the commands in the **BitsTransfer** module, type: Get-Command -Module BitsTransfer ``` -For more information about the `Get-Command` cmdlet, see -[Get-Command][11]. +For more information about the `Get-Command` cmdlet, see [Get-Command][11]. ## Remove a module diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Object_Creation.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Object_Creation.md index 8fbd64d0f2e3..60d49fc4ae42 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Object_Creation.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Object_Creation.md @@ -289,7 +289,7 @@ New-PSSession -ComputerName Server01 -SessionOption @{ IdleTimeout=43200000 SkipCnCheck=$True } -Register-ScheduledJob Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ +Register-ScheduledJob -Name Test -FilePath .\Get-Inventory.ps1 -Trigger @{ Frequency="Daily" At="15:00" } diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Objects.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Objects.md index a1ad26b7baf2..ddb14e76eb61 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Objects.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Objects.md @@ -38,7 +38,7 @@ in commands to take action and manage data. You can discover an objects properties and methods using [Get-Member](xref:Microsoft.PowerShell.Utility.Get-Member) or the `psobject` - [intrinsic member](about_Intrinsic_Members.md). +[intrinsic member](about_Intrinsic_Members.md). ## Objects in Pipelines diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md index 35d52148ccad..bd9af581f477 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md @@ -121,8 +121,8 @@ $read_only = ( Get-ChildItem *.txt | Where-Object {$_.isReadOnly} ) Because the pipeline operator (`|`) has a higher precedence than the assignment operator (`=`), the files that the `Get-ChildItem` cmdlet gets are sent to the -`Where-Object` cmdlet for filtering before they are assigned to the `$read_only` -variable. +`Where-Object` cmdlet for filtering before they are assigned to the +`$read_only` variable. The following example demonstrates that the index operator takes precedence over the cast operator. @@ -194,7 +194,7 @@ are reading and maintaining your scripts. [assign]: about_Assignment_Operators.md [compare]: about_Comparison_Operators.md [join]: about_Join.md -[logic]: about_logical_operators.md +[logic]: about_Logical_Operators.md [ops]: about_Operators.md [redir]: about_Redirection.md [scopes]: about_Scopes.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Operators.md index 629f2b7da486..e8d2d81f9e79 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Operators.md @@ -251,7 +251,7 @@ For more information, see [about_Parsing][08]. This example stores a command in a string and executes it using the call operator. -``` +```powershell PS> $c = "Get-ExecutionPolicy" PS> $c Get-ExecutionPolicy @@ -262,7 +262,7 @@ AllSigned The call operator doesn't parse strings. This means that you can't use command parameters within a string when you use the call operator. -``` +```powershell PS> $c = "Get-Service -Name Spooler" PS> $c Get-Service -Name Spooler @@ -276,7 +276,7 @@ try again. The [Invoke-Expression][25] cmdlet can execute code that causes parsing errors when using the call operator. -``` +```powershell PS> & "1+1" &: The term '1+1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was @@ -293,7 +293,7 @@ the contents of the quoted string instead of running the script. The call operator allows you to execute the contents of the string containing the filename. -``` +```powershell PS C:\Scripts> Get-ChildItem Directory: C:\Scripts @@ -465,7 +465,7 @@ objects to be formatted on the right side of the operator. "{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi ``` -```output +```Output 1 hello 3.14 ``` @@ -477,7 +477,7 @@ formatted string to. "{0:00} {1:000} {2:000000}" -f 7, 24, 365 ``` -```output +```Output 07 024 000365 ``` @@ -502,7 +502,7 @@ value. Given a list of indices, the index operator returns a list of members corresponding to those indices. -``` +```powershell PS> $a = 1, 2, 3 PS> $a[0] 1 @@ -523,7 +523,7 @@ $h = @{key="value"; name="PowerShell"; version="2.0"} $h["name"] ``` -```output +```Output PowerShell ``` @@ -532,7 +532,7 @@ $x = [xml]"Once upon a time..." $x["doc"] ``` -```output +```Output intro ----- Once upon a time... @@ -542,7 +542,7 @@ When an object isn't an indexed collection, using the index operator to access the first element returns the object itself. Index values beyond the first element return `$null`. -``` +```powershell PS> (2)[0] 2 PS> (2)[-1] @@ -707,7 +707,7 @@ expression. ```powershell $myProcess.peakWorkingSet -(Get-Process PowerShell).kill() +(Get-Process PowerShell).Kill() 'OS', 'Platform' | Foreach-Object { $PSVersionTable. $_ } ``` @@ -872,9 +872,9 @@ ${a}?[0] [10]: about_If.md [11]: about_Jobs.md [12]: about_Join.md -[13]: about_logical_operators.md +[13]: about_Logical_Operators.md [14]: about_Member-Access_Enumeration.md -[15]: about_operator_precedence.md +[15]: about_Operator_Precedence.md [16]: About_Pipeline_Chain_Operators.md [17]: about_Preference_Variables.md#ofs [18]: about_Redirection.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md index 28ecc5242653..2e1090453e88 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_PSConsoleHostReadLine.md @@ -9,6 +9,7 @@ title: about_PSConsoleHostReadLine # about_PSConsoleHostReadLine ## Short description + Explains how to customize how PowerShell reads input at the console prompt. ## Long description diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_PSCustomObject.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_PSCustomObject.md index 36366fe88ddd..c78ad724f10c 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_PSCustomObject.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_PSCustomObject.md @@ -1,7 +1,7 @@ --- description: Explains the differences between the [psobject] and [pscustomobject] type accelerators. Locale: en-US -ms.date: 10/11/2023 +ms.date: 07/02/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pscustomobject?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSCustomObject @@ -296,6 +296,6 @@ properties. [01]: about_Object_Creation.md [02]: about_Objects.md -[03]: about_type_accelerators.md +[03]: about_Type_Accelerators.md [04]: xref:System.Management.Automation.PSCustomObject [05]: xref:System.Management.Automation.PSObject diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_PSItem.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_PSItem.md index 68f3feedb9cd..9d32f58f894f 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_PSItem.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_PSItem.md @@ -41,9 +41,9 @@ cases. ## ForEach-Object Process -The [ForEach-Object][02] cmdlet is designed to operate -on objects in the pipeline, executing the **Process** parameter's scriptblock -once for every object in the pipeline. +The [ForEach-Object][02] cmdlet is designed to operate on objects in the +pipeline, executing the **Process** parameter's scriptblock once for every +object in the pipeline. You can use `$PSItem` in the **Process** parameter's scriptblock but not in the **Begin** or **End** parameter scriptblocks. If you reference `$PSItem` in the @@ -374,9 +374,9 @@ with the default format for the current culture by casting the value to ## See also - [about_Arrays][04] -- [about_automatic_variables][01] +- [about_Automatic_Variables][01] - [about_Comparison_Operators][12] -- [about_functions][08] +- [about_Functions][08] - [about_Script_Blocks][14] - [about_Switch][07] - [ForEach-Object][02] diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_PackageManagement.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_PackageManagement.md index f672b9ccf13e..e2da0954e642 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_PackageManagement.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_PackageManagement.md @@ -42,8 +42,7 @@ us define some terms: stored in a specific package source. The PackageManagement module includes the following cmdlets. For more -information, see the [PackageManagement](/powershell/module/packagemanagement) -help. +information, see the [PackageManagement][01] help. - `Get-PackageProvider`: Returns a list of package providers that are connected to PackageManagement. @@ -101,7 +100,7 @@ More Information About the PackageManagement Project For more information about the PackageManagement open development project, including how to create a PackageManagement package provider, see the -PackageManagement project on GitHub at https://oneget.org. +PackageManagement project on GitHub at [https://oneget.org][02]. ## See also @@ -115,3 +114,7 @@ PackageManagement project on GitHub at https://oneget.org. - [Register-PackageSource](xref:PackageManagement.Register-PackageSource) - [Set-PackageSource](xref:PackageManagement.Set-PackageSource) - [Unregister-PackageSource](xref:PackageManagement.Unregister-PackageSource) + + +[01]: /powershell/module/packagemanagement +[02]: https://oneget.org diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md index f4200fdd0af4..ccaeb0da2c86 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Binding.md @@ -93,6 +93,6 @@ example, see the [Visualize parameter binding][01] article. [01]: /powershell/scripting/learn/deep-dives/visualize-parameter-binding -[02]: about_functions_advanced_parameters.md#valuefrompipeline-argument -[03]: about_functions_advanced_parameters.md#valuefrompipelinebypropertyname-argument +[02]: about_Functions_Advanced_Parameters.md#valuefrompipeline-argument +[03]: about_Functions_Advanced_Parameters.md#valuefrompipelinebypropertyname-argument [04]: xref:Microsoft.PowerShell.Utility.Trace-Command diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md index b9fb45c4ab0f..c8940a2114d7 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameter_Sets.md @@ -163,7 +163,7 @@ which parameters can be used in each parameter set. ```powershell (Get-Command Measure-Lines).ParameterSets | - Select-Object -Property @{n='ParameterSetName';e={$_.name}}, + Select-Object -Property @{n='ParameterSetName';e={$_.Name}}, @{n='Parameters';e={$_.ToString()}} ``` @@ -272,4 +272,4 @@ $Var4 = 3 ``` -[01]: about_functions_cmdletbindingattribute.md +[01]: about_Functions_CmdletBindingAttribute.md diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters.md index 5a73fd45d1b6..7e03f4ebe16c 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters.md @@ -31,8 +31,8 @@ a value, but do not require the parameter name in the command. The type of parameters and the requirements for those parameters vary. To find information about the parameters of a command, use the `Get-Help` cmdlet. For -example, to find information about the parameters of the `Get-ChildItem` cmdlet, -type: +example, to find information about the parameters of the `Get-ChildItem` +cmdlet, type: ```powershell Get-Help Get-ChildItem @@ -179,8 +179,8 @@ Get-Service -Name $s #### Accepts Pipeline Input -This setting indicates whether you can use the pipeline operator (`|`) to send a -value to the parameter. +This setting indicates whether you can use the pipeline operator (`|`) to send +a value to the parameter. ``` Value Description diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index ae549bdefd2e..56c2f9716954 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -118,7 +118,7 @@ using an array. This example sets the default value of the ```powershell $PSDefaultParameterValues = @{ - 'Invoke-Command:ComputerName' = 'Server01','Server02' + 'Invoke-Command:ComputerName' = 'Server01', 'Server02' } ``` diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parsing.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parsing.md index bc14063792e6..bfea6511c190 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parsing.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parsing.md @@ -412,8 +412,7 @@ TestExe -echoargs --% """%ProgramFiles(x86)%\Microsoft\\"" > [ProcessStartInfo.ArgumentList][01]. PowerShell 7.3 also added the ability to trace parameter binding for native -commands. For more information, see -[Trace-Command][08]. +commands. For more information, see [Trace-Command][08]. ## Passing arguments to PowerShell commands diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md index 5dd6203956b1..6be4adc3baf4 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Pipelines.md @@ -272,8 +272,8 @@ pipeline to display a table of service objects. Get-Service | Format-Table -Property Name, DependentServices ``` -Functionally, this is like using the **InputObject** parameter of `Format-Table` -to submit the object collection. +Functionally, this is like using the **InputObject** parameter of +`Format-Table` to submit the object collection. For example, we can save the collection of services to a variable that's passed using the **InputObject** parameter. @@ -631,9 +631,9 @@ Get-Process | Where-Object CPU | Where-Object Path [02]: #investigating-pipeline-errors -[03]: about_command_syntax.md -[04]: about_foreach.md -[05]: about_objects.md -[06]: about_parameters.md +[03]: about_Command_Syntax.md +[04]: about_Foreach.md +[05]: about_Objects.md +[06]: about_Parameters.md [07]: about_Redirection.md [08]: xref:System.Data.DataTable.Rows diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index 7fd58e785fa5..992d90e2a828 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -111,7 +111,12 @@ 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' +$newModuleManifestSplat = @{ + Path = '.\TestModuleWithEdition.psd1' + CompatiblePSEditions = 'Desktop', 'Core' + PowerShellVersion = '5.1' +} +New-ModuleManifest @newModuleManifestSplat $ModuleInfo = Test-ModuleManifest -Path .\TestModuleWithEdition.psd1 $ModuleInfo.CompatiblePSEditions ``` From 000f743a112619869e255107aea515056a5dd812 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Thu, 23 Jan 2025 15:47:05 -0600 Subject: [PATCH 5/6] Update release notes and setup for new versions (#11725) * Update release notes and setup for new versions * Fix broken links --- .../Installing-PowerShell-on-Windows.md | 44 ++-- .../install/Installing-PowerShell-on-macOS.md | 42 ++-- .../install/PowerShell-Support-Lifecycle.md | 43 ++-- .../install/community-support.md | 8 +- .../docs-conceptual/install/install-alpine.md | 8 +- .../docs-conceptual/install/install-debian.md | 12 +- .../install/install-other-linux.md | 10 +- .../docs-conceptual/install/install-rhel.md | 12 +- .../docs-conceptual/install/install-ubuntu.md | 14 +- .../install/microsoft-update-faq.yml | 4 +- .../learn/experimental-features.md | 226 +++--------------- .../learn/shell/running-commands.md | 14 +- .../whats-new/What-s-New-in-PowerShell-72.md | 6 +- .../whats-new/What-s-New-in-PowerShell-73.md | 6 +- .../whats-new/What-s-New-in-PowerShell-74.md | 6 +- .../whats-new/What-s-New-in-PowerShell-75.md | 10 +- 16 files changed, 151 insertions(+), 314 deletions(-) diff --git a/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md b/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md index 17c50326236d..b3efbb801137 100644 --- a/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md +++ b/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on Windows -ms.date: 12/12/2024 +ms.date: 01/23/2025 title: Installing PowerShell on Windows --- # Installing PowerShell on Windows @@ -55,7 +55,7 @@ winget search Microsoft.PowerShell ```Output Name Id Version Source ----------------------------------------------------------------- -PowerShell Microsoft.PowerShell 7.4.6.0 winget +PowerShell Microsoft.PowerShell 7.4.7.0 winget PowerShell Preview Microsoft.PowerShell.Preview 7.5.0.101 winget ``` @@ -79,9 +79,9 @@ winget install --id Microsoft.PowerShell.Preview --source winget To install PowerShell on Windows, use the following links to download the install package from GitHub. -- [PowerShell-7.4.6-win-x64.msi][28] -- [PowerShell-7.4.6-win-x86.msi][30] -- [PowerShell-7.4.6-win-arm64.msi][36] +- [PowerShell-7.4.7-win-x64.msi][28] +- [PowerShell-7.4.7-win-x86.msi][30] +- [PowerShell-7.4.7-win-arm64.msi][36] Once downloaded, double-click the installer file and follow the prompts. @@ -151,7 +151,7 @@ installation options: The following example shows how to silently install PowerShell with all the install options enabled. ```powershell -msiexec.exe /package PowerShell-7.4.6-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 USE_MU=1 ENABLE_MU=1 ADD_PATH=1 +msiexec.exe /package PowerShell-7.4.7-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 USE_MU=1 ENABLE_MU=1 ADD_PATH=1 ``` For a full list of command-line options for `Msiexec.exe`, see @@ -162,9 +162,9 @@ For a full list of command-line options for `Msiexec.exe`, see PowerShell binary ZIP archives are provided to enable advanced deployment scenarios. Download one of the following ZIP archives from the [current release][23] page. -- [PowerShell-7.4.6-win-x64.zip][29] -- [PowerShell-7.4.6-win-x86.zip][31] -- [PowerShell-7.4.6-win-arm64.zip][27] +- [PowerShell-7.4.7-win-x64.zip][29] +- [PowerShell-7.4.7-win-x86.zip][31] +- [PowerShell-7.4.7-win-arm64.zip][27] Depending on how you download the file you may need to unblock the file using the `Unblock-File` cmdlet. Unzip the contents to the location of your choice and run `pwsh.exe` from there. Unlike @@ -261,7 +261,7 @@ If there is an available upgrade, the output indicates the latest available vers > [!NOTE] > When upgrading, PowerShell won't upgrade from an LTS version to a non-LTS version. It only -> upgrades to the latest version of LTS, for example, from 7.4.3 to 7.4.6. To upgrade from an +> upgrades to the latest version of LTS, for example, from 7.4.3 to 7.4.7. To upgrade from an > LTS release to a newer stable version or the next LTS, you need to install the new version with > the MSI for that release. > @@ -275,7 +275,7 @@ Windows 10 IoT Enterprise comes with Windows PowerShell, which we can use to dep ```powershell # Replace the placeholder information for the following variables: $deviceip = ' -$zipfile = 'PowerShell-7.4.6-win-x64.zip' +$zipfile = 'PowerShell-7.4.7-win-x64.zip' # Connect to the built-in instance of Windows PowerShell $session = New-PSSession -ComputerName $ipaddr -Credential $credential # Copy the file to the Nano Server instance @@ -360,7 +360,7 @@ Copy-Item $zipfile c:\ -ToSession $session # Enter the interactive remote session Enter-PSSession $session # Extract the ZIP file -Expand-Archive -Path C:\PowerShell-7.4.6-win-x64.zip -DestinationPath 'C:\Program Files\PowerShell 7' +Expand-Archive -Path C:\PowerShell-7.4.7-win-x64.zip -DestinationPath 'C:\Program Files\PowerShell 7' ``` If you want WSMan-based remoting, follow the instructions to create a remoting endpoint using the @@ -415,13 +415,13 @@ can't support those methods. [22]: https://aka.ms/powershell-release?tag=preview [23]: https://aka.ms/powershell-release?tag=stable [24]: https://github.com/ms-iot/iot-adk-addonkit/blob/master/Tools/IoTCoreImaging/Docs/Import-PSCoreRelease.md#Import-PSCoreRelease -[27]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-arm64.zip -[28]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.msi -[29]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.zip -[30]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x86.msi -[31]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x86.zip +[27]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/PowerShell-7.4.7-win-arm64.zip +[28]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/PowerShell-7.4.7-win-x64.msi +[29]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/PowerShell-7.4.7-win-x64.zip +[30]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/PowerShell-7.4.7-win-x86.msi +[31]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/PowerShell-7.4.7-win-x86.zip [32]: https://www.microsoft.com/download/details.aspx?id=50410 [33]: https://www.microsoft.com/store/apps/9MZ1SNWT0N5D [34]: microsoft-update-faq.yml [35]: https://techcommunity.microsoft.com/t5/windows-server-insiders/announcing-windows-server-preview-build-26085/m-p/4098829 -[36]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-arm64.msi +[36]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/PowerShell-7.4.7-win-arm64.msi diff --git a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md index d70bc591ca46..b9dea379f42b 100644 --- a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md +++ b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on macOS -ms.date: 12/12/2024 +ms.date: 01/23/2025 title: Installing PowerShell on macOS --- @@ -117,23 +117,23 @@ install package from the [releases][09] page onto your computer. The links to th are: - PowerShell 7.4 - - x64 processors - [powershell-7.4.6-osx-x64.pkg][20] - - Arm64 processors - [powershell-7.4.6-osx-arm64.pkg][18] + - x64 processors - [powershell-7.4.7-osx-x64.pkg][20] + - Arm64 processors - [powershell-7.4.7-osx-arm64.pkg][18] - PowerShell 7.5-rc.1 - - x64 processors - [powershell-7.5.0-rc.1-osx-x64.pkg][24] - - Arm64 processors - [powershell-7.5.0-rc.1-arm64.pkg][22] + - x64 processors - [powershell-7.5.0-osx-x64.pkg][24] + - Arm64 processors - [powershell-7.5.0-arm64.pkg][22] You can double-click the file and follow the prompts, or install it from the terminal using the following commands. Change the name of the file to match the file you downloaded. ```sh -sudo installer -pkg ./Downloads/powershell-7.4.6-osx-x64.pkg -target / +sudo installer -pkg ./Downloads/powershell-7.4.7-osx-x64.pkg -target / ``` If you are running on macOS Big Sur 11.5 or higher you may receive the following error message when installing the package: -> "powershell-7.4.6-osx-x64.pkg" cannot be opened because Apple cannot check it for malicious +> "powershell-7.4.7-osx-x64.pkg" cannot be opened because Apple cannot check it for malicious > software. There are two ways to work around this issue: @@ -146,7 +146,7 @@ Using the Finder From the command line -1. Run `sudo xattr -rd com.apple.quarantine ./Downloads/powershell-7.4.6-osx-x64.pkg`. If you are using +1. Run `sudo xattr -rd com.apple.quarantine ./Downloads/powershell-7.4.7-osx-x64.pkg`. If you are using PowerShell 7 or higher, you can use the `Unblock-File` cmdlet. Include the full path to the `.pkg` file. 1. Install the package as you normally would. @@ -186,18 +186,18 @@ Download the install package from the [releases][09] page onto your computer. Th current versions are: - PowerShell 7.4 (LTS) - - x64 processors - [powershell-7.4.6-osx-x64.tar.gz][21] - - Arm64 processors - [powershell-7.4.6-osx-arm64.tar.gz][19] + - x64 processors - [powershell-7.4.7-osx-x64.tar.gz][21] + - Arm64 processors - [powershell-7.4.7-osx-arm64.tar.gz][19] - PowerShell 7.5-preview - - x64 processors - [powershell-7.5.0-rc.1-osx-x64.tar.gz][25] - - Arm64 processors - [powershell-7.5.0-rc.1-osx-arm64.tar.gz][23] + - x64 processors - [powershell-7.5.0-osx-x64.tar.gz][25] + - Arm64 processors - [powershell-7.5.0-osx-arm64.tar.gz][23] Use the following commands to install PowerShell from the binary archive. Change the download URL to match the version you want to install. ```sh # Download the powershell '.tar.gz' archive -curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-osx-x64.tar.gz +curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-osx-x64.tar.gz # Create the target folder where powershell is placed sudo mkdir -p /usr/local/microsoft/powershell/7 @@ -276,12 +276,12 @@ support those methods. [11]: https://docs.brew.sh/Manpage#link-ln-options-formula [12]: https://github.com/Homebrew [13]: https://github.com/Homebrew/homebrew-cask -[18]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-osx-arm64.pkg -[19]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-osx-arm64.tar.gz -[20]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-osx-x64.pkg -[21]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-osx-x64.tar.gz -[22]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-7.5.0-rc.1-osx-arm64.pkg -[23]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-7.5.0-rc.1-osx-arm64.tar.gz -[24]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-7.5.0-rc.1-osx-x64.pkg -[25]: https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-7.5.0-rc.1-osx-x64.tar.gz +[18]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-osx-arm64.pkg +[19]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-osx-arm64.tar.gz +[20]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-osx-x64.pkg +[21]: https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-osx-x64.tar.gz +[22]: https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-7.5.0-osx-arm64.pkg +[23]: https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-7.5.0-osx-arm64.tar.gz +[24]: https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-7.5.0-osx-x64.pkg +[25]: https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-7.5.0-osx-x64.tar.gz [26]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html diff --git a/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md b/reference/docs-conceptual/install/PowerShell-Support-Lifecycle.md index df0a2f646cc0..494e8ab5134a 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: 01/17/2025 +ms.date: 01/23/2025 ms.topic: lifecycle title: PowerShell Support Lifecycle --- @@ -110,38 +110,31 @@ guarantees of responsiveness or fixes. The PowerShell support lifecycle follows the [support lifecycle of .NET][06]. The following table lists the end-of-support dates for the current versions of PowerShell: -| Version | Release Date | End-of-support | -| --------- | ------------------ | ------------------ | -| 7.4 (LTS) | November 16, 2023 | November 10, 2026 | +| Version | Release Date | End-of-support | .NET Version | +| ------------------------ | :----------: | :------------: | ------------------------- | +| PowerShell 7.6 (preview) | Future date | Future date | Built on [.NET 9.0.0][14] | +| PowerShell 7.5 | 23-Jan-2025 | 12-May-2026 | Built on [.NET 9.0.0][14] | +| PowerShell 7.4 (LTS) | 16-Nov-2023 | 10-Nov-2026 | Built on [.NET 8.0.0][13] | The following table lists the end-of-support dates for retired versions of PowerShell: -| Version | Release Date | End-of-support | -| --------- | ------------------ | ------------------ | -| 7.3 | November 9, 2022 | May 8, 2024 | -| 7.2 (LTS) | November 8, 2021 | November 8, 2024 | -| 7.0 (LTS) | March 4, 2020 | December 3, 2022 | -| 7.1 | November 11, 2020 | May 8, 2022 | -| 6.2 | March 28, 2019 | September 4, 2020 | -| 6.1 | September 13, 2018 | September 28, 2019 | -| 6.0 | January 20, 2018 | February 13, 2019 | +| Version | Release Date | End-of-support | .NET Version | +| -------------------- | :----------: | :------------: | ---------------------------- | +| PowerShell 7.3 | 09-Nov-2022 | 08-May-2024 | Built on [.NET 7.0][12] | +| PowerShell 7.2 (LTS) | 08-Nov-2021 | 08-Nov-2024 | Built on [.NET 6.0][11] | +| PowerShell 7.0 (LTS) | 04-Mar-2020 | 03-Dec-2022 | Built on [.NET 5.0][10] | +| PowerShell 7.1 | 11-Nov-2020 | 08-May-2022 | Built on [.NET Core 3.1][09] | +| PowerShell 6.2 | 29-Mar-2019 | 04-Sep-2020 | Built on [.NET Core 2.1][08] | +| PowerShell 6.1 | 13-Sep-2018 | 28-Sep-2019 | Built on [.NET Core 2.1][08] | +| PowerShell 6.0 | 20-Jan-2018 | 13-Feb-2019 | Built on [.NET Core 2.0][07] | -## Release history +## Windows PowerShell release history -The following table contains a historical timeline of the major releases of PowerShell. +The following table contains a historical timeline of the major releases of Windows PowerShell. +Microsoft no longer supports Windows PowerShell versions lower than 5.1. | Version | Release Date | Note | | ------------------------ | :----------: | -------------------------------------------------------------------------- | -| PowerShell 7.6 (preview) | Future | Built on [.NET 9.0.0][14] | -| PowerShell 7.5 (RC) | Future | Built on [.NET 9.0.0][14] | -| PowerShell 7.4 (LTS) | Nov-2023 | Built on [.NET 8.0.0][13] | -| PowerShell 7.3 | Nov-2022 | Built on [.NET 7.0][12] | -| PowerShell 7.2 (LTS) | Nov-2021 | Built on [.NET 6.0][11] | -| PowerShell 7.1 | Nov-2020 | Built on [.NET 5.0][10] | -| PowerShell 7.0 (LTS) | Mar-2020 | Built on [.NET Core 3.1][09] | -| PowerShell 6.2 | Mar-2019 | Built on [.NET Core 2.1][08] | -| PowerShell 6.1 | Sep-2018 | Built on [.NET Core 2.1][08] | -| PowerShell 6.0 | Jan-2018 | Built on [.NET Core 2.0][07]. Installable on Windows, Linux, and macOS | | Windows PowerShell 5.1 | Aug-2016 | Released in Windows 10 Anniversary Update and Windows Server 2016, WMF 5.1 | | Windows PowerShell 5.0 | Feb-2016 | Released in Windows Management Framework (WMF) 5.0 | | Windows PowerShell 4.0 | Oct-2013 | Released in Windows 8.1 and with Windows Server 2012 R2, WMF 4.0 | diff --git a/reference/docs-conceptual/install/community-support.md b/reference/docs-conceptual/install/community-support.md index be9938ee73cb..288c633b403e 100644 --- a/reference/docs-conceptual/install/community-support.md +++ b/reference/docs-conceptual/install/community-support.md @@ -1,6 +1,6 @@ --- description: PowerShell can run on Linux distributions that aren't officially supported by Microsoft. -ms.date: 08/27/2024 +ms.date: 01/23/2025 title: Community support for PowerShell on Linux --- # Community support for PowerShell on Linux @@ -77,9 +77,9 @@ the following article provides information on how to install PowerShell on openS Download the tar.gz package from the [releases][09] page onto your Raspberry Pi computer. The links to the current versions are: -- PowerShell 7.4.6 - latest LTS release - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-arm32.tar.gz` - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-arm64.tar.gz` +- PowerShell 7.4.7 - latest LTS release + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-linux-arm32.tar.gz` + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-linux-arm64.tar.gz` Use the following shell commands to download and install the package. This script detects whether you're running a 32-bit or 64-bit OS and installs the latest stable version of PowerShell for that diff --git a/reference/docs-conceptual/install/install-alpine.md b/reference/docs-conceptual/install/install-alpine.md index 50a4d10009b8..48798b98ac5f 100644 --- a/reference/docs-conceptual/install/install-alpine.md +++ b/reference/docs-conceptual/install/install-alpine.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on Alpine Linux -ms.date: 12/16/2024 +ms.date: 01/23/2025 title: Installing PowerShell on Alpine Linux --- # Installing PowerShell on Alpine Linux @@ -20,8 +20,8 @@ check the list of [Supported versions][02] below. Installation on Alpine is based on downloading tar.gz package from the [releases][03] page. The URL to the package depends on the version of PowerShell you want to install. -- PowerShell 7.4.6 - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-musl-x64.tar.gz` -- PowerShell 7.5.0-rc.1 - `https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-7.5.0-rc.1-linux-musl-x64.tar.gz` +- PowerShell 7.4.7 - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-linux-musl-x64.tar.gz` +- PowerShell 7.5.0 - `https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-7.5.0-linux-musl-x64.tar.gz` Then, in the terminal, execute the following shell commands to install PowerShell 7.4: @@ -47,7 +47,7 @@ apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \ openssh-client \ # Download the powershell '.tar.gz' archive -curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-musl-x64.tar.gz -o /tmp/powershell.tar.gz +curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-linux-musl-x64.tar.gz -o /tmp/powershell.tar.gz # Create the target folder where powershell will be placed sudo mkdir -p /opt/microsoft/powershell/7 diff --git a/reference/docs-conceptual/install/install-debian.md b/reference/docs-conceptual/install/install-debian.md index 4a9639f1d871..a2b40f3bf4a2 100644 --- a/reference/docs-conceptual/install/install-debian.md +++ b/reference/docs-conceptual/install/install-debian.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on Debian Linux -ms.date: 12/12/2024 +ms.date: 01/23/2025 title: Installing PowerShell on Debian --- # Installing PowerShell on Debian @@ -70,9 +70,9 @@ package from the [releases][02] page onto your Debian machine. The link to the current version is: - PowerShell 7.4 (LTS) universal package for supported versions of Debian - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell_7.4.6-1.deb_amd64.deb` + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell_7.4.7-1.deb_amd64.deb` - PowerShell 7.5-preview universal package for supported versions of Debian - - `https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-preview_7.5.0-rc.1-1.deb_amd64.deb` + - `https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-preview_7.5.0-1.deb_amd64.deb` The following shell script downloads and installs the current release of PowerShell. You can change the URL to download the version of PowerShell that you want to install. @@ -88,17 +88,17 @@ 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.6/powershell_7.4.6-1.deb_amd64.deb +wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell_7.4.7-1.deb_amd64.deb ################################### # Install the PowerShell package -sudo dpkg -i powershell_7.4.6-1.deb_amd64.deb +sudo dpkg -i powershell_7.4.7-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_7.4.6-1.deb_amd64.deb +rm powershell_7.4.7-1.deb_amd64.deb # Start PowerShell pwsh diff --git a/reference/docs-conceptual/install/install-other-linux.md b/reference/docs-conceptual/install/install-other-linux.md index ad813cbb8a9d..84a2c695a454 100644 --- a/reference/docs-conceptual/install/install-other-linux.md +++ b/reference/docs-conceptual/install/install-other-linux.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on various Linux distributions -ms.date: 08/20/2024 +ms.date: 01/23/2025 title: Alternate ways to install PowerShell on Linux --- # Alternate ways to install PowerShell on Linux @@ -132,16 +132,16 @@ archive. The following example shows the steps for installing the x64 binary archive. You must choose the correct binary archive that matches the processor type for your platform. -- `powershell-7.4.6-linux-arm32.tar.gz` -- `powershell-7.4.6-linux-arm64.tar.gz` -- `powershell-7.4.6-linux-x64.tar.gz` +- `powershell-7.4.7-linux-arm32.tar.gz` +- `powershell-7.4.7-linux-arm64.tar.gz` +- `powershell-7.4.7-linux-x64.tar.gz` Use the following shell commands to download and install PowerShell from the `tar.gz` binary archive. Change the URL to match the version of PowerShell you want to install. ```sh # Download the powershell '.tar.gz' archive -curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-linux-x64.tar.gz +curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-linux-x64.tar.gz # Create the target folder where powershell will be placed sudo mkdir -p /opt/microsoft/powershell/7 diff --git a/reference/docs-conceptual/install/install-rhel.md b/reference/docs-conceptual/install/install-rhel.md index 5c183ea1c0d8..bdca3471d456 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: 12/12/2024 +ms.date: 01/23/2025 title: Installing PowerShell on Red Hat Enterprise Linux (RHEL) --- # Installing PowerShell on Red Hat Enterprise Linux (RHEL) @@ -64,10 +64,10 @@ package from the [releases][02] page onto your RHEL machine. The link to the current version is: -- PowerShell 7.4.6 universal package for supported versions of RHEL - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-1.rh.x86_64.rpm` -- PowerShell 7.5.0-rc.1 universal package for supported versions of RHEL - - `https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-preview-7.5.0_preview.2-1.rh.x86_64.rpm` +- PowerShell 7.4.7 universal package for supported versions of RHEL + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-1.rh.x86_64.rpm` +- PowerShell 7.5.0 universal package for supported versions of RHEL + - `https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-preview-7.5.0_preview.2-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 the version of PowerShell that you want to install. @@ -75,7 +75,7 @@ change the URL to download the version of PowerShell that you want to install. On RHEL 8 or 9: ```sh -sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell-7.4.6-1.rh.x86_64.rpm +sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell-7.4.7-1.rh.x86_64.rpm ``` ## Uninstall PowerShell diff --git a/reference/docs-conceptual/install/install-ubuntu.md b/reference/docs-conceptual/install/install-ubuntu.md index 9132352ccd0d..c1889baccc47 100644 --- a/reference/docs-conceptual/install/install-ubuntu.md +++ b/reference/docs-conceptual/install/install-ubuntu.md @@ -1,6 +1,6 @@ --- description: Information about installing PowerShell on Ubuntu -ms.date: 12/12/2024 +ms.date: 01/23/2025 title: Installing PowerShell on Ubuntu --- # Installing PowerShell on Ubuntu @@ -82,9 +82,9 @@ package from the [releases][05] page onto your Ubuntu machine. The link to the current version is: - PowerShell 7.4 (LTS) universal package for supported versions of Ubuntu - - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell_7.4.6-1.deb_amd64.deb` -- PowerShell 7.5.0-rc.1 universal package for supported versions of Ubuntu - - `https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-preview_7.5.0-rc.1-1.deb_amd64.deb` + - `https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell_7.4.7-1.deb_amd64.deb` +- PowerShell 7.5.0 universal package for supported versions of Ubuntu + - `https://github.com/PowerShell/PowerShell/releases/download/7.5.0/powershell-preview_7.5.0-1.deb_amd64.deb` The following shell script downloads and installs the current preview release of PowerShell. You can change the URL to download the version of PowerShell that you want to install. @@ -100,17 +100,17 @@ 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.6/powershell_7.4.6-1.deb_amd64.deb +wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.7/powershell_7.4.7-1.deb_amd64.deb ################################### # Install the PowerShell package -sudo dpkg -i powershell_7.4.6-1.deb_amd64.deb +sudo dpkg -i powershell_7.4.7-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_7.4.6-1.deb_amd64.deb +rm powershell_7.4.7-1.deb_amd64.deb # Start PowerShell Preview pwsh diff --git a/reference/docs-conceptual/install/microsoft-update-faq.yml b/reference/docs-conceptual/install/microsoft-update-faq.yml index e4aa99133979..b29e9272fc2c 100644 --- a/reference/docs-conceptual/install/microsoft-update-faq.yml +++ b/reference/docs-conceptual/install/microsoft-update-faq.yml @@ -1,6 +1,6 @@ ### YamlMime:FAQ metadata: - ms.date: 08/20/2024 + ms.date: 01/23/2025 title: Microsoft Update for PowerShell FAQ description: Frequently asked questions about the using Microsoft Update to update PowerShell ms.topic: faq @@ -108,7 +108,7 @@ sections: doesn't show the check box options. To enable MU updates run the following command: ```powershell - msiexec.exe /fmu .\PowerShell-7.4.6-win-x64.msi USE_MU=1 ENABLE_MU=1 + msiexec.exe /fmu .\PowerShell-7.4.7-win-x64.msi USE_MU=1 ENABLE_MU=1 ``` For more information about running `msiexec.exe` from the command line, see diff --git a/reference/docs-conceptual/learn/experimental-features.md b/reference/docs-conceptual/learn/experimental-features.md index 1f52ccbaa599..60db76186c09 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/24/2024 +ms.date: 01/23/2025 title: Using Experimental Features in PowerShell --- # Using Experimental Features in PowerShell @@ -15,14 +15,14 @@ breaking changes. > [!CAUTION] > Experimental features aren't intended to be used in production since the changes are allowed to be > breaking. Experimental features aren't officially supported. However, we appreciate any feedback -> and bug reports. You can file issues in the [GitHub source repository][26]. +> and bug reports. You can file issues in the [GitHub source repository][16]. For more information about enabling or disabling these features, see -[about_Experimental_Features][06]. +[about_Experimental_Features][05]. ## Experimental feature lifecycle -The [Get-ExperimentalFeature][30] cmdlet returns all experimental features available to PowerShell. +The [Get-ExperimentalFeature][19] cmdlet returns all experimental features available to PowerShell. Experimental features can come from modules or the PowerShell engine. Module-based experimental features are only available after you import the module. In the following example, the **PSDesiredStateConfiguration** isn't loaded, so the `PSDesiredStateConfiguration.InvokeDscResource` @@ -44,7 +44,7 @@ PSSerializeJSONLongEnumAsNumber True PSEngine Serialize enums based on long PSSubsystemPluginModel True PSEngine A plugin model for registering and un-registering… ``` -Use the [Enable-ExperimentalFeature][29] and [Disable-ExperimentalFeature][28] cmdlets to enable or +Use the [Enable-ExperimentalFeature][18] and [Disable-ExperimentalFeature][17] cmdlets to enable or disable a feature. You must start a new PowerShell session for this change to be in effect. Run the following command to enable the `PSCommandNotFoundSuggestion` feature: @@ -82,38 +82,18 @@ Legend - The ![Discontinued][03] icon indicates the version of PowerShell where the experimental feature was removed -| Name | 7.2 | 7.4 | 7.5 (preview) | +| Name | 7.4 | 7.5 | 7.6 (preview) | | --------------------------------------------------- | :-----------------: | :-----------------: | :-----------------: | -| [PSCommandNotFoundSuggestion][10] | ![Experimental][02] | ![Experimental][02] | ![Mainstream][01] | -| [PSDesiredStateConfiguration.InvokeDscResource][14] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | -| [PSNativePSPathResolution][21] | ![Experimental][02] | | | -| [PSSubsystemPluginModel][23] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | -| [PSNativeCommandArgumentPassing][18] | ![Experimental][02] | | | -| [PSAnsiRenderingFileInfo][09] | ![Experimental][02] | | | -| [PSLoadAssemblyFromNativeCode][16] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | -| [PSNativeCommandErrorActionPreference][19] | | ![Mainstream][01] | | -| [PSFeedbackProvider][15] | | ![Experimental][02] | ![Experimental][02] | -| [PSModuleAutoLoadSkipOfflineFiles][17] | | ![Experimental][02] | ![Mainstream][01] | -| [PSCommandWithArgs][11] | | ![Experimental][02] | ![Mainstream][01] | -| [PSNativeWindowsTildeExpansion][22] | | | ![Experimental][02] | -| [PSRedirectToVariable][24] | | | ![Experimental][02] | -| [PSSerializeJSONLongEnumAsNumber][25] | | | ![Experimental][02] | - -### PSAnsiRenderingFileInfo - -> [!NOTE] -> This feature became mainstream in PowerShell 7.3. - -The ANSI formatting features were added in PowerShell 7.2. This feature adds the `$PSStyle.FileInfo` -member and enables coloring of specific file types. - -- `$PSStyle.FileInfo.Directory` - Built-in member to specify the color for directories -- `$PSStyle.FileInfo.SymbolicLink` - Built-in member to specify the color for symbolic links -- `$PSStyle.FileInfo.Executable` - Built-in member to specify the color for executables. -- `$PSStyle.FileInfo.Extension` - Use this member to define the colors for different file - extensions. The **Extension** member pre-includes extensions for archive and PowerShell files. - -For more information, see [about_Automatic_Variables][05]. +| [PSCommandNotFoundSuggestion][06] | ![Experimental][02] | ![Mainstream][01] | ![Mainstream][01] | +| [PSDesiredStateConfiguration.InvokeDscResource][08] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | +| [PSSubsystemPluginModel][15] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | +| [PSLoadAssemblyFromNativeCode][10] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | +| [PSFeedbackProvider][09] | ![Experimental][02] | ![Experimental][02] | ![Experimental][02] | +| [PSModuleAutoLoadSkipOfflineFiles][11] | ![Experimental][02] | ![Mainstream][01] | ![Mainstream][01] | +| [PSCommandWithArgs][07] | ![Experimental][02] | ![Mainstream][01] | ![Mainstream][01] | +| [PSNativeWindowsTildeExpansion][12] | | ![Experimental][02] | ![Experimental][02] | +| [PSRedirectToVariable][13] | | ![Experimental][02] | ![Experimental][02] | +| [PSSerializeJSONLongEnumAsNumber][14] | | ![Experimental][02] | ![Experimental][02] | ### PSCommandNotFoundSuggestion @@ -211,132 +191,6 @@ always kept on disk. This feature was added in PowerShell 7.4-preview.1. -### PSNativeCommandArgumentPassing - -> [!NOTE] -> This feature became mainstream in PowerShell 7.3. - -When this experimental feature is enabled PowerShell uses the `ArgumentList` property of the -`StartProcessInfo` object rather than our current mechanism of reconstructing a string when invoking -a native executable. - -> [!CAUTION] -> The new behavior is a **breaking change** from current behavior. This may break scripts and -> automation that work around the various issues when invoking native applications. Historically, -> quotes must be escaped and it isn't possible to provide empty arguments to a native application. -> Use the [stop-parsing token][08] (`--%`) or the [`Start-Process`][32] cmdlet to sidestep native -> argument passing when needed. - -This feature adds a new `$PSNativeCommandArgumentPassing` preference variable that controls this -behavior. This variable allows you to select the behavior at runtime. The valid values are `Legacy`, -`Standard`, and `Windows`. The default behavior is platform specific. On Windows platforms, the -default setting is `Windows` and non-Windows platforms default to `Standard`. - -`Legacy` is the historic behavior. The behavior of `Windows` and `Standard` mode are the same -except, in `Windows` mode, invocations of the following files automatically use the `Legacy` style -argument passing. - - -- `cmd.exe` -- `find.exe` -- `cscript.exe` -- `wscript.exe` -- `sqlcmd.exe` - Added in PowerShell 7.3.1 -- ending with `.bat` -- ending with `.cmd` -- ending with `.js` -- ending with `.vbs` -- ending with `.wsf` - -If the `$PSNativeCommandArgumentPassing` is set to either `Legacy` or `Standard`, the parser doesn't -check for these files. - -The default behavior is platform specific. On Windows platforms, the default setting is `Windows` -and non-Windows platforms is `Standard`. - -> [!NOTE] -> The following examples use the `TestExe.exe` tool. You can build `TestExe` from the source code. -> See [TestExe][27] in the PowerShell source repository. - -New behaviors made available by this change: - -- Literal or expandable strings with embedded quotes the quotes are preserved: - - ```powershell - PS> $a = 'a" "b' - PS> TestExe -echoargs $a 'c" "d' e" "f - Arg 0 is - Arg 1 is - Arg 2 is - ``` - -- Empty strings as arguments are preserved: - - ```powershell - PS> TestExe -echoargs '' a b '' - Arg 0 is <> - Arg 1 is - Arg 2 is - Arg 3 is <> - ``` - -For more examples of the new behavior, see [about_Parsing][07]. - -PowerShell 7.3 also added the ability to trace parameter binding for native commands. For more -information, see [Trace-Command][34]. - -### PSNativeCommandErrorActionPreference - - - -> [!NOTE] -> 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 -stream. Redirected **stderr** output isn't interpreted the same as the PowerShell error stream. Many -native commands use stderr as an information or verbose stream, thus only the exit code matters. -Users working with native commands in their scripts need to check the exit status after each call -using similar to the following example: - -```powershell -if ($LASTEXITCODE -ne 0) { - throw "Command failed. See above errors for details" -} -``` - -However, this example doesn't support all cases where `$?` can be false from a cmdlet or function -error, making `$LASTEXITCODE` stale. - -This feature implements the `$PSNativeCommandUseErrorActionPreference` preference variable that -controls how native commands errors are handled in PowerShell. This allows native command failures -to produce error objects that are added to the PowerShell error stream and may terminate execution -of the script without extra handling. - -`$PSNativeCommandUseErrorActionPreference` is set to `$false` by default. With the preference set to -`$true` you get the following behavior: - -- When `$ErrorActionPreference = 'Stop'`, scripts will break when a native command returns a - non-zero exit code. -- When `$ErrorActionPreference = 'Continue'` (the default), you will see PowerShell error messages - for native command errors, but scripts won't break. - -### PSNativePSPathResolution - -> [!NOTE] -> This experimental feature was removed in PowerShell 7.3 and is no longer supported. - -If a PSDrive path that uses the FileSystem provider is passed to a native command, the resolved file -path is passed to the native command. This means a command like `code temp:/test.txt` now works as -expected. - -Also, on Windows, if the path starts with `~`, that's resolved to the full path and passed to the -native command. In both cases, the path is normalized to the directory separators for the relevant -operating system. - -- If the path isn't a PSDrive or `~` (on Windows), then path normalization doesn't occur -- If the path is in single quotes, then it's not resolved and treated as literal - ### PSRedirectToVariable > [!NOTE] @@ -376,7 +230,7 @@ the PSReadLine module to provide custom prediction plugins. In future, **Job**, **CommandCompleter**, **Remoting** and other components could be separated into subsystem assemblies outside of `System.Management.Automation.dll`. -The experimental feature includes a new cmdlet, [Get-PSSubsystem][31]. This cmdlet is only available +The experimental feature includes a new cmdlet, [Get-PSSubsystem][20]. This cmdlet is only available when the feature is enabled. This cmdlet returns information about the subsystems that are available on the system. @@ -405,7 +259,7 @@ This feature was added in PowerShell 7.5-preview.2. ### PSSerializeJSONLongEnumAsNumber -This feature enables the cmdlet [ConvertTo-Json][33] to serialize any enum values based on +This feature enables the cmdlet [ConvertTo-Json][21] to serialize any enum values based on `Int64/long` or `UInt64/ulong` as a numeric value rather than the string representation of that enum value. This aligns the behavior of enum serialization with other enum base types where the cmdlet serializes enums as their numeric value. Use the **EnumsAsStrings** parameter to serialize as the @@ -438,30 +292,20 @@ For example: [02]: ../../media/shared/construction-sign-1f6a7.svg [03]: ../../media/shared/cross-mark-274c.svg [04]: /powershell/dsc/overview?view=dsc-3.0&preserve-view=true -[05]: /powershell/module/microsoft.powershell.core/about/about_automatic_variables -[06]: /powershell/module/microsoft.powershell.core/about/about_experimental_features -[07]: /powershell/module/microsoft.powershell.core/about/about_parsing -[08]: /powershell/module/microsoft.powershell.core/about/about_parsing#the-stop-parsing-token -[09]: #psansirenderingfileinfo -[10]: #pscommandnotfoundsuggestion -[11]: #pscommandwithargs -[14]: #psdesiredstateconfigurationinvokedscresource -[15]: #psfeedbackprovider -[16]: #psloadassemblyfromnativecode -[17]: #psmoduleautoloadskipofflinefiles -[18]: #psnativecommandargumentpassing -[19]: #psnativecommanderroractionpreference -[21]: #psnativepspathresolution -[22]: #psnativewindowstildeexpansion -[23]: #pssubsystempluginmodel -[24]: #psredirecttovariable -[25]: #psserializejsonlongenumasnumber -[26]: https://github.com/PowerShell/PowerShell/issues/new/choose -[27]: https://github.com/PowerShell/PowerShell/tree/master/test/tools/TestExe -[28]: xref:Microsoft.PowerShell.Core.Disable-ExperimentalFeature -[29]: xref:Microsoft.PowerShell.Core.Enable-ExperimentalFeature -[30]: xref:Microsoft.PowerShell.Core.Get-ExperimentalFeature -[31]: xref:Microsoft.PowerShell.Core.Get-PSSubsystem -[32]: xref:Microsoft.PowerShell.Management.Start-Process -[33]: xref:Microsoft.PowerShell.Utility.ConvertTo-Json -[34]: xref:Microsoft.PowerShell.Utility.Trace-Command +[05]: /powershell/module/microsoft.powershell.core/about/about_experimental_features +[06]: #pscommandnotfoundsuggestion +[07]: #pscommandwithargs +[08]: #psdesiredstateconfigurationinvokedscresource +[09]: #psfeedbackprovider +[10]: #psloadassemblyfromnativecode +[11]: #psmoduleautoloadskipofflinefiles +[12]: #psnativewindowstildeexpansion +[13]: #psredirecttovariable +[14]: #psserializejsonlongenumasnumber +[15]: #pssubsystempluginmodel +[16]: https://github.com/PowerShell/PowerShell/issues/new/choose +[17]: xref:Microsoft.PowerShell.Core.Disable-ExperimentalFeature +[18]: xref:Microsoft.PowerShell.Core.Enable-ExperimentalFeature +[19]: xref:Microsoft.PowerShell.Core.Get-ExperimentalFeature +[20]: xref:Microsoft.PowerShell.Core.Get-PSSubsystem +[21]: xref:Microsoft.PowerShell.Utility.ConvertTo-Json diff --git a/reference/docs-conceptual/learn/shell/running-commands.md b/reference/docs-conceptual/learn/shell/running-commands.md index 61d271b6f8b9..41a911ad2ccb 100644 --- a/reference/docs-conceptual/learn/shell/running-commands.md +++ b/reference/docs-conceptual/learn/shell/running-commands.md @@ -2,7 +2,7 @@ description: > This article shows how to run commands in PowerShell. title: Running commands in the shell -ms.date: 08/22/2022 +ms.date: 01/23/2025 --- # Running commands in the shell @@ -73,8 +73,8 @@ For more information, see the following articles: - [about_Parsing][1] - [about_Quoting_Rules][2] -PowerShell 7.2 introduced a new experimental feature `PSnativeCommandArgumentPassing` that improved -native command handling. For more information, see [PSnativeCommandArgumentPassing][3]. +PowerShell 7.2 introduced a new experimental feature `PSNativeCommandArgumentPassing` that improved +native command handling. For more information, see [`$PSNativeCommandArgumentPassing`][3]. ### Handling output and errors @@ -97,9 +97,9 @@ Many native commands write to **stderr** as an alternative stream for additional behavior can cause confusion in PowerShell when looking through errors and the additional output information can be lost if `$ErrorActionPreference` is set to a state that mutes the output. -PowerShell 7.3 added a new experimental feature `PSnativeCommandErrorActionPreference` that allows +PowerShell 7.3 added a new experimental feature `PSNativeCommandErrorActionPreference` that allows you to control whether output to `stderr` is treated as an error. For more information, see -[PSnativeCommandErrorActionPreference][6]. +[`$PSNativeCommandUseErrorActionPreference`][6]. ## Running PowerShell commands @@ -154,10 +154,10 @@ For more information, see [Invoke-Item][9]. [1]: /powershell/module/microsoft.powershell.core/about/about_parsing#passing-arguments-to-native [2]: /powershell/module/microsoft.powershell.core/about/about_quoting_rules -[3]: ../experimental-features.md#psnativecommandargumentpassing +[3]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing [4]: /powershell/module/microsoft.powershell.core/about/about_redirection [5]: /powershell/module/microsoft.powershell.core/about/about_output_streams -[6]: ../experimental-features.md#psnativecommanderroractionpreference +[6]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommanduseerroractionpreference [7]: /powershell/module/microsoft.powershell.core/about/about_operators#call-operator- [8]: /powershell/module/microsoft.powershell.management/start-process [9]: /powershell/module/microsoft.powershell.management/invoke-item diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-72.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-72.md index bfca41ea6b31..42c314585fa0 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-72.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-72.md @@ -1,7 +1,7 @@ --- title: What's New in PowerShell 7.2 description: New features and changes released in PowerShell 7.2 -ms.date: 01/20/2023 +ms.date: 01/23/2025 --- # What's New in PowerShell 7.2 @@ -146,9 +146,9 @@ Install-Module -Name PSDesiredStateConfiguration -Repository PSGallery -MaximumV [01]: ../learn/experimental-features.md -[02]: ../learn/experimental-features.md#psansirenderingfileinfo +[02]: /powershell/module/microsoft.powershell.core/about/about_ansi_terminals#psstyle [03]: ../learn/experimental-features.md#psloadassemblyfromnativecode -[04]: ../learn/experimental-features.md#psnativecommandargumentpassing +[04]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing [05]: /powershell/module/microsoft.powershell.core/about/about_ansi_terminals [06]: /powershell/module/microsoft.powershell.utility/import-powershelldatafile [07]: /powershell/scripting/install/installing-powershell-core-on-linux diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md index 77eb7f6671bd..e927e6259f25 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md @@ -1,7 +1,7 @@ --- title: What's New in PowerShell 7.3 description: New features and changes released in PowerShell 7.3 -ms.date: 02/27/2023 +ms.date: 01/23/2025 --- # What's New in PowerShell 7.3 @@ -147,8 +147,8 @@ For more information about the Experimental Features, see [Using Experimental Fe [01]: ../learn/experimental-features.md -[06]: ../learn/experimental-features.md#psnativecommanderroractionpreference -[08]: ../learn/experimental-features.md#psnativecommandargumentpassing +[06]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommanduseerroractionpreference +[08]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing [09]: https://github.com/dotnet/runtime/issues/66746 [10]: https://github.com/PowerShell/PowerShell/issues/17018 [11]: https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0 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 338e2e2dc31b..0e1752d8d0d4 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 description: New features and changes released in PowerShell 7.4 -ms.date: 06/19/2024 +ms.date: 01/23/2025 --- # What's New in PowerShell 7.4 -PowerShell 7.4 includes the following features, updates, and breaking changes. PowerShell 7.4 is -built on .NET 8.0.0. +PowerShell 7.4.7 includes the following features, updates, and breaking changes. PowerShell 7.4.7 is +built on .NET 8.0.12. For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repository. diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md index 6faf74fe3c19..c07c55a9db2a 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md @@ -1,13 +1,13 @@ --- title: What's New in PowerShell 7.5 description: New features and changes released in PowerShell 7.5 -ms.date: 12/05/2024 +ms.date: 01/23/2025 --- # What's New in PowerShell 7.5 -PowerShell 7.5-rc.1 includes the following features, updates, and breaking changes. PowerShell -7.5 is built on .NET 9.0.100 GA release. +PowerShell 7.5.0 includes the following features, updates, and breaking changes. PowerShell +7.5 is built on .NET 9.0.1 GA release. For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repository. @@ -24,9 +24,9 @@ For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repositor ## Updated modules -PowerShell 7.5-rc.1 includes the following updated modules: +PowerShell 7.5.0 includes the following updated modules: -- **Microsoft.PowerShell.PSResourceGet** v1.1.0-RC2 +- **Microsoft.PowerShell.PSResourceGet** v1.1.0 - **PSReadLine** v2.3.6 ## Tab completion improvements From ef1a9784a82d1c6ab4241e16f21878711b8f86cc Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Thu, 23 Jan 2025 16:12:49 -0600 Subject: [PATCH 6/6] Update PSReadLine release notes (#11726) --- .../About/about_PSReadLine_Release_Notes.md | 26 +++++++++++++------ .../About/about_PSReadLine_Release_Notes.md | 26 +++++++++++++------ .../About/about_PSReadLine_Release_Notes.md | 26 +++++++++++++------ .../About/about_PSReadLine_Release_Notes.md | 26 +++++++++++++------ 4 files changed, 72 insertions(+), 32 deletions(-) diff --git a/reference/5.1/PSReadLine/About/about_PSReadLine_Release_Notes.md b/reference/5.1/PSReadLine/About/about_PSReadLine_Release_Notes.md index 5151bdd8fa68..d37bc376d74c 100644 --- a/reference/5.1/PSReadLine/About/about_PSReadLine_Release_Notes.md +++ b/reference/5.1/PSReadLine/About/about_PSReadLine_Release_Notes.md @@ -1,7 +1,7 @@ --- description: This article contains the list of changes for each released version of PSReadLine. Locale: en-US -ms.date: 09/17/2024 +ms.date: 01/23/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline_release_notes?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSReadLine_Release_Notes @@ -12,18 +12,19 @@ This is a summary of changes to the **PSReadLine** module. For a full list of changes, see the **PSReadLine** [ChangeLog][01]. - Current preview: v2.4.0-beta0 -- Current stable release: v2.3.5 +- Current stable release: v2.3.6 ## PSReadLine release history There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. -- v2.3.5 first shipped in PowerShell 7.4.2 and 7.5.0-preview.3 -- v2.3.4 first shipped in PowerShell 7.4.0-rc.1 -- v2.2.6 first shipped in PowerShell 7.3.0 -- v2.1.0 first shipped in PowerShell 7.2.5 -- v2.0.4 first shipped in PowerShell 7.0.11 +- v2.3.6 shipped in PowerShell 7.5.0 +- v2.3.5 shipped in PowerShell 7.4.2 and 7.5.0-preview.3 +- v2.3.4 shipped in PowerShell 7.4.0-rc.1 +- v2.2.6 shipped in PowerShell 7.3.0 +- v2.1.0 shipped in PowerShell 7.2.5 +- v2.0.4 shipped in PowerShell 7.0.11 - v2.0.0 ships in Windows PowerShell 5.1 ## Release Notes @@ -37,9 +38,18 @@ Windows PowerShell 5.1. - Fix a few VI key handlers to correctly close the edit group - Read the history file in the streaming way to handle large files efficiently +### v2.3.6 - 2024-10-03 + +This is a servicing release for the build pipeline. There are no changes to +PSReadLine in this release. + ### v2.3.5 - 2024-04-02 -This is a servicing release that excludes test components from SBOM generation. +This is a servicing release that fixes two issues: + +1. Exclude test components from SBOM generation to avoid false positive + security vulnerability report. +1. Include the fix to a regression found in the v2.3.4 of PSReadLine. ### v2.3.4 - 2023-10-02 diff --git a/reference/7.4/PSReadLine/About/about_PSReadLine_Release_Notes.md b/reference/7.4/PSReadLine/About/about_PSReadLine_Release_Notes.md index 4a28bf5d16d7..e9235380eb84 100644 --- a/reference/7.4/PSReadLine/About/about_PSReadLine_Release_Notes.md +++ b/reference/7.4/PSReadLine/About/about_PSReadLine_Release_Notes.md @@ -1,7 +1,7 @@ --- description: This article contains the list of changes for each released version of PSReadLine. Locale: en-US -ms.date: 09/17/2024 +ms.date: 01/23/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline_release_notes?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSReadLine_Release_Notes @@ -12,18 +12,19 @@ This is a summary of changes to the **PSReadLine** module. For a full list of changes, see the **PSReadLine** [ChangeLog][01]. - Current preview: v2.4.0-beta0 -- Current stable release: v2.3.5 +- Current stable release: v2.3.6 ## PSReadLine release history There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. -- v2.3.5 first shipped in PowerShell 7.4.2 and 7.5.0-preview.3 -- v2.3.4 first shipped in PowerShell 7.4.0-rc.1 -- v2.2.6 first shipped in PowerShell 7.3.0 -- v2.1.0 first shipped in PowerShell 7.2.5 -- v2.0.4 first shipped in PowerShell 7.0.11 +- v2.3.6 shipped in PowerShell 7.5.0 +- v2.3.5 shipped in PowerShell 7.4.2 and 7.5.0-preview.3 +- v2.3.4 shipped in PowerShell 7.4.0-rc.1 +- v2.2.6 shipped in PowerShell 7.3.0 +- v2.1.0 shipped in PowerShell 7.2.5 +- v2.0.4 shipped in PowerShell 7.0.11 - v2.0.0 ships in Windows PowerShell 5.1 ## Release Notes @@ -37,9 +38,18 @@ Windows PowerShell 5.1. - Fix a few VI key handlers to correctly close the edit group - Read the history file in the streaming way to handle large files efficiently +### v2.3.6 - 2024-10-03 + +This is a servicing release for the build pipeline. There are no changes to +PSReadLine in this release. + ### v2.3.5 - 2024-04-02 -This is a servicing release that excludes test components from SBOM generation. +This is a servicing release that fixes two issues: + +1. Exclude test components from SBOM generation to avoid false positive + security vulnerability report. +1. Include the fix to a regression found in the v2.3.4 of PSReadLine. ### v2.3.4 - 2023-10-02 diff --git a/reference/7.5/PSReadLine/About/about_PSReadLine_Release_Notes.md b/reference/7.5/PSReadLine/About/about_PSReadLine_Release_Notes.md index 9c4c5a64f813..4edd66b68354 100644 --- a/reference/7.5/PSReadLine/About/about_PSReadLine_Release_Notes.md +++ b/reference/7.5/PSReadLine/About/about_PSReadLine_Release_Notes.md @@ -1,7 +1,7 @@ --- description: This article contains the list of changes for each released version of PSReadLine. Locale: en-US -ms.date: 09/17/2024 +ms.date: 01/23/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline_release_notes?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSReadLine_Release_Notes @@ -12,18 +12,19 @@ This is a summary of changes to the **PSReadLine** module. For a full list of changes, see the **PSReadLine** [ChangeLog][01]. - Current preview: v2.4.0-beta0 -- Current stable release: v2.3.5 +- Current stable release: v2.3.6 ## PSReadLine release history There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. -- v2.3.5 first shipped in PowerShell 7.4.2 and 7.5.0-preview.3 -- v2.3.4 first shipped in PowerShell 7.4.0-rc.1 -- v2.2.6 first shipped in PowerShell 7.3.0 -- v2.1.0 first shipped in PowerShell 7.2.5 -- v2.0.4 first shipped in PowerShell 7.0.11 +- v2.3.6 shipped in PowerShell 7.5.0 +- v2.3.5 shipped in PowerShell 7.4.2 and 7.5.0-preview.3 +- v2.3.4 shipped in PowerShell 7.4.0-rc.1 +- v2.2.6 shipped in PowerShell 7.3.0 +- v2.1.0 shipped in PowerShell 7.2.5 +- v2.0.4 shipped in PowerShell 7.0.11 - v2.0.0 ships in Windows PowerShell 5.1 ## Release Notes @@ -37,9 +38,18 @@ Windows PowerShell 5.1. - Fix a few VI key handlers to correctly close the edit group - Read the history file in the streaming way to handle large files efficiently +### v2.3.6 - 2024-10-03 + +This is a servicing release for the build pipeline. There are no changes to +PSReadLine in this release. + ### v2.3.5 - 2024-04-02 -This is a servicing release that excludes test components from SBOM generation. +This is a servicing release that fixes two issues: + +1. Exclude test components from SBOM generation to avoid false positive + security vulnerability report. +1. Include the fix to a regression found in the v2.3.4 of PSReadLine. ### v2.3.4 - 2023-10-02 diff --git a/reference/7.6/PSReadLine/About/about_PSReadLine_Release_Notes.md b/reference/7.6/PSReadLine/About/about_PSReadLine_Release_Notes.md index c7c543b55607..4b7d2d44d751 100644 --- a/reference/7.6/PSReadLine/About/about_PSReadLine_Release_Notes.md +++ b/reference/7.6/PSReadLine/About/about_PSReadLine_Release_Notes.md @@ -1,7 +1,7 @@ --- description: This article contains the list of changes for each released version of PSReadLine. Locale: en-US -ms.date: 09/17/2024 +ms.date: 01/23/2025 online version: https://learn.microsoft.com/powershell/module/psreadline/about/about_psreadline_release_notes?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_PSReadLine_Release_Notes @@ -12,18 +12,19 @@ This is a summary of changes to the **PSReadLine** module. For a full list of changes, see the **PSReadLine** [ChangeLog][01]. - Current preview: v2.4.0-beta0 -- Current stable release: v2.3.5 +- Current stable release: v2.3.6 ## PSReadLine release history There have been many updates to PSReadLine since the version that ships in Windows PowerShell 5.1. -- v2.3.5 first shipped in PowerShell 7.4.2 and 7.5.0-preview.3 -- v2.3.4 first shipped in PowerShell 7.4.0-rc.1 -- v2.2.6 first shipped in PowerShell 7.3.0 -- v2.1.0 first shipped in PowerShell 7.2.5 -- v2.0.4 first shipped in PowerShell 7.0.11 +- v2.3.6 shipped in PowerShell 7.5.0 +- v2.3.5 shipped in PowerShell 7.4.2 and 7.5.0-preview.3 +- v2.3.4 shipped in PowerShell 7.4.0-rc.1 +- v2.2.6 shipped in PowerShell 7.3.0 +- v2.1.0 shipped in PowerShell 7.2.5 +- v2.0.4 shipped in PowerShell 7.0.11 - v2.0.0 ships in Windows PowerShell 5.1 ## Release Notes @@ -37,9 +38,18 @@ Windows PowerShell 5.1. - Fix a few VI key handlers to correctly close the edit group - Read the history file in the streaming way to handle large files efficiently +### v2.3.6 - 2024-10-03 + +This is a servicing release for the build pipeline. There are no changes to +PSReadLine in this release. + ### v2.3.5 - 2024-04-02 -This is a servicing release that excludes test components from SBOM generation. +This is a servicing release that fixes two issues: + +1. Exclude test components from SBOM generation to avoid false positive + security vulnerability report. +1. Include the fix to a regression found in the v2.3.4 of PSReadLine. ### v2.3.4 - 2023-10-02