diff --git a/reference/7.4/Microsoft.PowerShell.Management/Wait-Process.md b/reference/7.4/Microsoft.PowerShell.Management/Wait-Process.md index df993efa69a3..d08abe252fc0 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Wait-Process.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Wait-Process.md @@ -98,6 +98,8 @@ When multiple processes are passed into `Wait-Process`, the cmdlet waits for all before returning. With this parameter, the cmdlet returns when any of the processes exits. The remaining processes continue to run. +This parameter was added in PowerShell 7.4. + ```yaml Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) @@ -167,6 +169,8 @@ Accept wildcard characters: False By default, this cmdlet doesn't output anything. With this parameter, the cmdlet returns objects representing the processes that were waited on. +This parameter was added in PowerShell 7.4. + ```yaml Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Get-Unique.md b/reference/7.4/Microsoft.PowerShell.Utility/Get-Unique.md index 32fade2bea33..393b656748d3 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Get-Unique.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Get-Unique.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 01/23/2023 +ms.date: 08/18/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-unique?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Get-Unique @@ -18,13 +18,13 @@ Returns unique items from a sorted list. ### AsString (Default) ``` -Get-Unique [-InputObject ] [-AsString] [] +Get-Unique [-InputObject ] [-AsString] [-CaseInsensitive] [] ``` ### UniqueByType ``` -Get-Unique [-InputObject ] [-OnType] [] +Get-Unique [-InputObject ] [-OnType] [-CaseInsensitive] [] ``` ## DESCRIPTION @@ -32,8 +32,8 @@ Get-Unique [-InputObject ] [-OnType] [] The `Get-Unique` cmdlet compares each item in a sorted list to the next item, eliminates duplicates, and returns only one instance of each item. The list must be sorted for the cmdlet to work properly. -`Get-Unique` is case-sensitive. As a result, strings that differ only in character casing are -considered to be unique. +By default, `Get-Unique` is case-sensitive. As a result, strings that differ only in character +casing are considered to be unique. ## EXAMPLES @@ -110,6 +110,34 @@ The **AsString** parameter tells `Get-Unique` to treat the **ProcessName** value Without this parameter, `Get-Unique` treats the **ProcessName** values as objects and returns only one instance of the object, that is, the first process name in the list. +### Example 5: Use case-sensitive comparisons to get unique strings + +This example uses case-insensitive comparisons to get unique strings from an array of strings. + +```powershell +"aa", "Aa", "Bb", "bb", "aa" | Sort-Object -CaseSensitive | Get-Unique +``` + +```Output +aa +Aa +bb +Bb +``` + +### Example 6: Use case-insensitive comparisons to get unique strings + +This example uses case-insensitive comparisons to get unique strings from an array of strings. + +```powershell +"aa", "Aa", "Bb", "bb", "aa" | Sort-Object | Get-Unique -CaseInsensitive +``` + +```Output +aa +Bb +``` + ## PARAMETERS ### -AsString @@ -126,7 +154,26 @@ Aliases: Required: False Position: Named -Default value: None +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CaseInsensitive + +By default, `Get-Unique` is case-sensitive. When you use this parameter, the cmdlet uses +case-insensitive comparisons. + +This parameter was added in PowerShell 7.4. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` @@ -136,9 +183,9 @@ Accept wildcard characters: False Specifies input for `Get-Unique`. Enter a variable that contains the objects or type a command or expression that gets the objects. -This cmdlet treats the input submitted by using **InputObject** as a collection. it does not +This cmdlet treats the input submitted using **InputObject** as a collection. It doesn't enumerate individual items in the collection. Because the collection is a single item, input -submitted by using **InputObject** is always returned unchanged. +submitted using **InputObject** is always returned unchanged. ```yaml Type: System.Management.Automation.PSObject @@ -172,7 +219,8 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, --WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Select-Object.md b/reference/7.4/Microsoft.PowerShell.Utility/Select-Object.md index 3e7e5a532301..a42ea45031ea 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Select-Object.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 06/01/2023 +ms.date: 08/18/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Select-Object @@ -19,27 +19,30 @@ Selects objects or object properties. ``` Select-Object [-InputObject ] [[-Property] ] [-ExcludeProperty ] - [-ExpandProperty ] [-Unique] [-Last ] [-First ] [-Skip ] [-Wait] - [] + [-ExpandProperty ] [-Unique] [-CaseInsensitive] [-Last ] [-First ] [-Skip ] + [-Wait] [] ``` ### SkipLastParameter ``` Select-Object [-InputObject ] [[-Property] ] [-ExcludeProperty ] - [-ExpandProperty ] [-Unique] [-Skip ] [-SkipLast ] [] + [-ExpandProperty ] [-Unique] [-CaseInsensitive] [-Skip ] [-SkipLast ] + [] ``` ### IndexParameter ``` -Select-Object [-InputObject ] [-Unique] [-Wait] [-Index ] [] +Select-Object [-InputObject ] [-Unique] [-CaseInsensitive] [-Wait] [-Index ] + [] ``` ### SkipIndexParameter ``` -Select-Object [-InputObject ] [-Unique] [-SkipIndex ] [] +Select-Object [-InputObject ] [-Unique] [-CaseInsensitive] [-SkipIndex ] + [] ``` ## DESCRIPTION @@ -139,13 +142,14 @@ This example uses the **Unique** parameter of `Select-Object` to get unique char of characters. ```powershell -"a","b","c","a","a","a" | Select-Object -Unique +"a","b","c","a","A","a" | Select-Object -Unique ``` ```Output a b c +A ``` ### Example 5: Using `-Unique` with other parameters @@ -165,7 +169,20 @@ a In this example, **First** selects `"a","a"` as the first 2 items in the array. **Unique** is applied to `"a","a"` and returns `a` as the unique value. -### Example 6: Select newest and oldest events in the event log +### Example 6: Select unique strings using the `-CaseInsensitive` parameter + +This example uses case-insensitive comparisons to get unique strings from an array of strings. + +```powershell +"aa", "Aa", "Bb", "bb" | Select-Object -Unique -CaseInsensitive +``` + +```Output +aa +Bb +``` + +### Example 7: Select newest and oldest events in the event log This example gets the first (newest) and last (oldest) events in the Windows PowerShell event log. @@ -179,7 +196,7 @@ $a = Get-WinEvent -LogName "Windows PowerShell" $a | Select-Object -Index 0, ($a.count - 1) ``` -### Example 7: Select all but the first object +### Example 8: Select all but the first object This example creates a new PSSession on each of the computers listed in the Servers.txt files, except for the first one. @@ -191,7 +208,7 @@ of computers is set as the value of the **ComputerName** parameter of the `New-P New-PSSession -ComputerName (Get-Content Servers.txt | Select-Object -Skip 1) ``` -### Example 8: Rename files and select several to review +### Example 9: Rename files and select several to review This example adds a "-ro" suffix to the base names of text files that have the read-only attribute and then displays the first five files so the user can see a sample of the effect. @@ -211,7 +228,7 @@ Get-ChildItem *.txt -ReadOnly | Select-Object -First 5 -Wait ``` -### Example 9: Show the intricacies of the -ExpandProperty parameter +### Example 10: Show the intricacies of the -ExpandProperty parameter This example shows the intricacies of the **ExpandProperty** parameter. @@ -269,7 +286,7 @@ ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider pro Name NoteProperty string Name=CustomObject ``` -### Example 10: Create custom properties on objects +### Example 11: Create custom properties on objects The following example demonstrates using `Select-Object` to add a custom property to any object. When you specify a property name that doesn't exist, `Select-Object` creates that property as a @@ -287,7 +304,7 @@ MyCustomProperty New Custom Property ``` -### Example 11: Create calculated properties for each InputObject +### Example 12: Create calculated properties for each InputObject This example demonstrates using `Select-Object` to add calculated properties to your input. Passing a **ScriptBlock** to the **Property** parameter causes `Select-Object` to evaluate the expression on @@ -334,7 +351,7 @@ Diagnostics.Format.ps1xml 4.955078125 223 DotNetTypes.format.ps1xml 134.9833984375 223 ``` -### Example 12: Select hashtable keys without using calculated properties +### Example 13: Select hashtable keys without using calculated properties Beginning in PowerShell 6, `Select-Object` supports selecting the keys of **hashtable** input as properties. The following example selects the `weight` and `name` keys on an input hashtable and @@ -352,6 +369,25 @@ a 7 ## PARAMETERS +### -CaseInsensitive + +By default, when you use the **Unique** parameter the cmdlet uses case-sensitive comparisons. When +you use this parameter, the cmdlet uses case-insensitive comparisons. + +This parameter was added in PowerShell 7.4. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ExcludeProperty Specifies the properties that this cmdlet excludes from the operation. Wildcards are permitted. @@ -574,7 +610,8 @@ member of the subset should be selected. **Unique** selects values _after_ other filtering parameters are applied. This parameter is case-sensitive. As a result, strings that differ only in character casing are -considered to be unique. +considered to be unique. Add the **CaseInsensitive** parameter to perform case-insensitive +comparisons. ```yaml Type: System.Management.Automation.SwitchParameter