From be6b09549dd0979faf1f5de3ba4cef9a85a74d5b Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Wed, 27 Oct 2021 17:01:13 -0500 Subject: [PATCH 1/2] Update notes for 7.2-rc.1 (#8267) --- .../learn/security-features.md | 25 ++++++++++++------- .../whats-new/What-s-New-in-PowerShell-72.md | 4 ++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/reference/docs-conceptual/learn/security-features.md b/reference/docs-conceptual/learn/security-features.md index 4eb831a7ec59..16e9b317910f 100644 --- a/reference/docs-conceptual/learn/security-features.md +++ b/reference/docs-conceptual/learn/security-features.md @@ -1,6 +1,6 @@ --- description: PowerShell has several features designed to improve the security of your scripting environment. -ms.date: 09/23/2021 +ms.date: 10/27/2021 title: PowerShell security features --- # PowerShell security features @@ -59,6 +59,10 @@ AppLocker contains new capabilities and extensions that enable you to create rul apps from running based on unique identities of files and to specify which users or groups can run those apps. +For more information about AppLocker and Windows Defender Application Control (WDAC), see +[Application Controls for Windows][WDAC] and +[WDAC and AppLocker feature availability][availability]. + ### Security Servicing Criteria PowerShell follows the [Microsoft Security Servicing Criteria for Windows][mssec]. @@ -72,15 +76,18 @@ The table below outlines the features that meet the servicing criteria and those | Constrained language mode - with AppLocker | Defense in Depth | | Execution Policy | Defense in Depth | -> [!NOTE] -> There is a corner-case scenario in AppLocker where you only have **Deny** rules and constrained -> language mode is not used to enforce the policy that allows you to bypass the execution policy. -> Beginning in PowerShell 7.2, a change was made to ensure AppLocker rules take precedence -> over a `Set-ExecutionPolicy -ExecutionPolicy Bypass` command. +### Changes in PowerShell 7.2 -For more information about AppLocker and Windows Defender Application Control (WDAC), see -[Application Controls for Windows][WDAC] and -[WDAC and AppLocker feature availability][availability]. +- There was a corner-case scenario in AppLocker where you only have **Deny** rules and constrained + mode is not used to enforce the policy that allows you to bypass the execution policy. Beginning + in PowerShell 7.2, a change was made to ensure AppLocker rules take precedence over a + `Set-ExecutionPolicy -ExecutionPolicy Bypass` command. + +- PowerShell 7.2 now disallows the use of te `Add-Type` cmdlet in a **NoLanguage** mode PowerShell + session on a locked down machine. + +- PowerShell 7.2 now disallows scripts from using COM objects in AppLocker system lock down + conditions. Cmdlet that use COM or DCOM internally are not affected. [applocker]: /windows/security/threat-protection/windows-defender-application-control/applocker/what-is-applocker 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 8aa3353b16b6..085b372b51e8 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: 09/23/2021 +ms.date: 10/27/2021 --- # What's New in PowerShell 7.2 @@ -143,6 +143,8 @@ Install-Module -Name PSDesiredStateConfiguration -Repository PSGallery -MaximumV - Improve detection of mutable value types (#12495) - Restrict `New-Object` in **NoLanguage** mode under lock down (#14140) - Enforce AppLocker Deny configuration before Execution Policy Bypass configuration (#15035) +- Change `FileSystemInfo.Target` from a **CodeProperty** to an **AliasProperty** that points to + `FileSystemInfo.LinkTarget` (#16165) From af67c6611b18c97393bb75a5d1c1cc6f0dc36601 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Thu, 28 Oct 2021 12:29:03 -0500 Subject: [PATCH 2/2] Simplify example descriptions (#8269) --- .../Set-ItemProperty.md | 125 +++++++++--------- .../Set-ItemProperty.md | 48 ++++--- .../Set-ItemProperty.md | 49 ++++--- .../Set-ItemProperty.md | 49 ++++--- 4 files changed, 130 insertions(+), 141 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Management/Set-ItemProperty.md b/reference/5.1/Microsoft.PowerShell.Management/Set-ItemProperty.md index 64288c6eecf0..0d8284d36fe1 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Set-ItemProperty.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Set-ItemProperty.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 10/18/2018 +ms.date: 10/28/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-ItemProperty @@ -77,33 +77,17 @@ Set-ItemProperty -Path C:\GroupFiles\final.doc -Name IsReadOnly -Value $true This example shows how to use `Set-ItemProperty` to create a new registry entry and to assign a value to the entry. It creates the "NoOfEmployees" entry in the "ContosoCompany" key in -"HKLM\Software" key and sets its value to 823. +`HKLM\Software` key and sets its value to 823. Because registry entries are considered to be properties of the registry keys, which are items, you use `Set-ItemProperty` to create registry entries, and to establish and change their values. -The first command creates the registry entry. -It uses **Path** to specify the path of the `HKLM:` drive and the "Software\MyCompany" key. -The command uses **Name** to specify the entry name and **Value** to specify a value. - -The second command uses the `Get-ItemProperty` cmdlet to see the new registry entry. If you use the -`Get-Item` or `Get-ChildItem` cmdlets, the entries do not appear because they are properties of a -key, not items or child items. - -The third command changes the value of the **NoOfEmployees** entry to 824. - -You can also use the `New-ItemProperty` cmdlet to create the registry entry and its value and then -use `Set-ItemProperty` to change the value. - -For more information about the `HKLM:` drive, type `Get-Help Get-PSDrive`. -For more information about how to use PowerShell to manage the registry, type `Get-Help Registry`. - ```powershell Set-ItemProperty -Path "HKLM:\Software\ContosoCompany" -Name "NoOfEmployees" -Value 823 Get-ItemProperty -Path "HKLM:\Software\ContosoCompany" ``` -```output +```Output PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\contosocompany PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software PSChildName : contosocompany @@ -111,7 +95,6 @@ PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry NoOfLocations : 2 NoOfEmployees : 823 - ``` ```powershell @@ -129,18 +112,27 @@ NoOfLocations : 2 NoOfEmployees : 824 ``` -### Example 3: Modify an item by using the pipeline +The first command creates the registry entry. +It uses **Path** to specify the path of the `HKLM:` drive and the `Software\MyCompany` key. +The command uses **Name** to specify the entry name and **Value** to specify a value. + +The second command uses the `Get-ItemProperty` cmdlet to see the new registry entry. +If you use the `Get-Item` or `Get-ChildItem` cmdlets, the entries do not appear because they are +properties of a key, not items or child items. + +The third command changes the value of the **NoOfEmployees** entry to 824. + +You can also use the `New-ItemProperty` cmdlet to create the registry entry and its value and then +use `Set-ItemProperty` to change the value. -These commands show how to use a pipeline operator (`|`) to send an item to `Set-ItemProperty`. +For more information about the `HKLM:` drive, type `Get-Help Get-PSDrive`. +For more information about how to use PowerShell to manage the registry, type `Get-Help Registry`. -The first part of the command uses `Get-ChildItem` to get an object that represents the "Weekly.txt" -file. -The command uses a pipeline operator to send the file object to `Set-ItemProperty`. -The `Set-ItemProperty` command uses the **Name** and **Value** parameters to specify the property -and its new value. +### Example 3: Modify an item by using the pipeline -This command is equivalent to using the **InputObject** parameter to specify the object that -`Get-ChildItem` gets. +Th example uses `Get-ChildItem` to get the `weekly.txt` file. The file object is piped to +`Set-ItemProperty`. The `Set-ItemProperty` command uses the **Name** and **Value** parameters to +specify the property and its new value. ```powershell Get-ChildItem weekly.txt | Set-ItemProperty -Name IsReadOnly -Value $True @@ -150,13 +142,6 @@ Get-ChildItem weekly.txt | Set-ItemProperty -Name IsReadOnly -Value $True ### -Credential -Specifies a user account that has permission to perform this action. -The default is the current user. - -Type a user name, such as "User01" or "Domain01\User01", or enter a **PSCredential** object, such as -one generated by the `Get-Credential` cmdlet. -If you type a user name, you are prompted for a password. - > [!NOTE] > This parameter is not supported by any providers installed with PowerShell. > To impersonate another user, or elevate your credentials when running this cmdlet, @@ -176,10 +161,11 @@ Accept wildcard characters: False ### -Exclude -Specifies those items upon which the cmdlet does not act, and includes all others. -The value of this parameter qualifies the **Path** parameter. -Enter a path element or pattern, such as "*.txt". -Wildcard characters are permitted. +Specifies, as a string array, an item or items that this cmdlet excludes in the operation. The value +of this parameter qualifies the **Path** parameter. Enter a path element or pattern, such as +`*.txt`. Wildcard characters are permitted. The **Exclude** parameter is effective only when the +command includes the contents of an item, such as `C:\Windows\*`, where the wildcard character +specifies the contents of the `C:\Windows` directory. ```yaml Type: System.String[] @@ -190,17 +176,18 @@ Required: False Position: Named Default value: None Accept pipeline input: False -Accept wildcard characters: False +Accept wildcard characters: True ``` ### -Filter -Specifies a filter in the format or language of the provider. -The value of this parameter qualifies the **Path** parameter. - -The syntax of the filter, including the use of wildcard characters, depends on the provider. -Filters are more efficient than other parameters, because the provider applies them when the cmdlet -gets the objects rather than having PowerShell filter the objects after they are retrieved. +Specifies a filter to qualify the **Path** parameter. The +[FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) provider is the only +installed PowerShell provider that supports the use of filters. You can find the syntax for the +**FileSystem** filter language in +[about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). Filters are more efficient +than other parameters, because the provider applies them when the cmdlet gets the objects rather +than having PowerShell filter the objects after they are retrieved. ```yaml Type: System.String @@ -234,10 +221,11 @@ Accept wildcard characters: False ### -Include -Specifies only those items upon which the cmdlet acts, which excludes all others. -The value of this parameter qualifies the **Path** parameter. -Enter a path element or pattern, such as "*.txt". -Wildcard characters are permitted. +Specifies, as a string array, an item or items that this cmdlet includes in the operation. The value +of this parameter qualifies the **Path** parameter. Enter a path element or pattern, such as +`"*.txt"`. Wildcard characters are permitted. The **Include** parameter is effective only when the +command includes the contents of an item, such as `C:\Windows\*`, where the wildcard character +specifies the contents of the `C:\Windows` directory. ```yaml Type: System.String[] @@ -248,7 +236,7 @@ Required: False Position: Named Default value: None Accept pipeline input: False -Accept wildcard characters: False +Accept wildcard characters: True ``` ### -InputObject @@ -270,11 +258,13 @@ Accept wildcard characters: False ### -LiteralPath -Specifies a path of the item property. -Unlike the **Path** parameter, the value of **LiteralPath** is used exactly as it is typed. -No characters are interpreted as wildcards. -If the path includes escape characters, enclose it in single quotation marks. -Single quotation marks tell PowerShell not to interpret any characters as escape sequences. +Specifies a path to one or more locations. The value of **LiteralPath** is used exactly as it is +typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose +it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters +as escape sequences. + +For more information, see +[about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). ```yaml Type: System.String[] @@ -324,6 +314,7 @@ Accept wildcard characters: False ### -Path Specifies the path of the items with the property to modify. +Wildcard characters are permitted. ```yaml Type: System.String[] @@ -334,7 +325,7 @@ Required: True Position: 0 Default value: None Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False +Accept wildcard characters: True ``` ### -Type @@ -357,7 +348,7 @@ The acceptable values for this parameter are: - **Unknown**: Indicates an unsupported registry data type, such as **REG_RESOURCE_LIST**. ```yaml -Type: RegistryValueKind +Type: Microsoft.Win32.RegistryValueKind Parameter Sets: (All) Aliases: @@ -391,7 +382,7 @@ Accept wildcard characters: False Specifies the value of the property. ```yaml -Type: Object +Type: System.Object Parameter Sets: propertyValuePathSet, propertyValueLiteralPathSet Aliases: @@ -407,7 +398,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -424,7 +415,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -437,7 +428,10 @@ Accept wildcard characters: False ### CommonParameters -This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). ## Inputs @@ -456,7 +450,8 @@ generate any output. ## Notes `Set-ItemProperty` is designed to work with the data exposed by any provider. To list the providers -available in your session, type `Get-PSProvider`. For more information, see [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). +available in your session, type `Get-PSProvider`. For more information, see +[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). ## Related links @@ -473,3 +468,5 @@ available in your session, type `Get-PSProvider`. For more information, see [abo [Remove-ItemProperty](Remove-ItemProperty.md) [Rename-ItemProperty](Rename-ItemProperty.md) + +[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md) diff --git a/reference/7.0/Microsoft.PowerShell.Management/Set-ItemProperty.md b/reference/7.0/Microsoft.PowerShell.Management/Set-ItemProperty.md index f13019b49ce3..ff02a5d9a804 100644 --- a/reference/7.0/Microsoft.PowerShell.Management/Set-ItemProperty.md +++ b/reference/7.0/Microsoft.PowerShell.Management/Set-ItemProperty.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 05/14/2019 +ms.date: 10/28/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-ItemProperty @@ -68,8 +68,8 @@ The file is a **System.IO.FileInfo** object and **IsReadOnly** is just one of it To see all of the properties, type `Get-Item C:\GroupFiles\final.doc | Get-Member -MemberType Property`. -The `$true` automatic variable represents a value of "TRUE". -For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +The `$true` automatic variable represents a value of "TRUE". For more information, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```powershell Set-ItemProperty -Path C:\GroupFiles\final.doc -Name IsReadOnly -Value $true @@ -115,7 +115,7 @@ NoOfEmployees : 824 ``` The first command creates the registry entry. -It uses **Path** to specify the path of the `HKLM:` drive and the "Software\MyCompany" key. +It uses **Path** to specify the path of the `HKLM:` drive and the `Software\MyCompany` key. The command uses **Name** to specify the entry name and **Value** to specify a value. The second command uses the `Get-ItemProperty` cmdlet to see the new registry entry. @@ -132,15 +132,9 @@ For more information about how to use PowerShell to manage the registry, type `G ### Example 3: Modify an item by using the pipeline -These commands show how to use a pipeline operator (`|`) to send an item to `Set-ItemProperty`. - -The first part of the command uses `Get-ChildItem` to get an object that represents the "Weekly.txt" -file. The command uses a pipeline operator to send the file object to `Set-ItemProperty`. -The `Set-ItemProperty` command uses the **Name** and **Value** parameters to specify the property -and its new value. - -This command is equivalent to using the **InputObject** parameter to specify the object that -`Get-ChildItem` gets. +Th example uses `Get-ChildItem` to get the `weekly.txt` file. The file object is piped to +`Set-ItemProperty`. The `Set-ItemProperty` command uses the **Name** and **Value** parameters to +specify the property and its new value. ```powershell Get-ChildItem weekly.txt | Set-ItemProperty -Name IsReadOnly -Value $True @@ -189,11 +183,13 @@ Accept wildcard characters: True ### -Filter -Specifies a filter to qualify the **Path** parameter. The [FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) -provider is the only installed PowerShell provider that supports the use of filters. You can find -the syntax for the **FileSystem** filter language in [about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). -Filters are more efficient than other parameters, because the provider applies them when the cmdlet -gets the objects rather than having PowerShell filter the objects after they are retrieved. +Specifies a filter to qualify the **Path** parameter. The +[FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) provider is the only +installed PowerShell provider that supports the use of filters. You can find the syntax for the +**FileSystem** filter language in +[about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). Filters are more efficient +than other parameters, because the provider applies them when the cmdlet gets the objects rather +than having PowerShell filter the objects after they are retrieved. ```yaml Type: System.String @@ -269,7 +265,8 @@ typed. No characters are interpreted as wildcards. If the path includes escape c it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. -For more information, see [about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). +For more information, see +[about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). ```yaml Type: System.String[] @@ -415,9 +412,9 @@ Accept wildcard characters: False ### CommonParameters -This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, -`-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, -`-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). ## Inputs @@ -431,13 +428,14 @@ You can pipe objects to this cmdlet. ### None, System.Management.Automation.PSCustomObject This cmdlet generates a **PSCustomObject** object that represents the item that was changed and its -new property value, if you specify the **PassThru** parameter. -Otherwise, this cmdlet does not generate any output. +new property value, if you specify the **PassThru** parameter. Otherwise, this cmdlet does not +generate any output. ## Notes `Set-ItemProperty` is designed to work with the data exposed by any provider. To list the providers -available in your session, type `Get-PSProvider`. For more information, see [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). +available in your session, type `Get-PSProvider`. For more information, see +[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). ## Related links diff --git a/reference/7.1/Microsoft.PowerShell.Management/Set-ItemProperty.md b/reference/7.1/Microsoft.PowerShell.Management/Set-ItemProperty.md index 4d7439bed053..87bfd3b4346f 100644 --- a/reference/7.1/Microsoft.PowerShell.Management/Set-ItemProperty.md +++ b/reference/7.1/Microsoft.PowerShell.Management/Set-ItemProperty.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 05/14/2019 +ms.date: 10/28/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-ItemProperty @@ -68,8 +68,8 @@ The file is a **System.IO.FileInfo** object and **IsReadOnly** is just one of it To see all of the properties, type `Get-Item C:\GroupFiles\final.doc | Get-Member -MemberType Property`. -The `$true` automatic variable represents a value of "TRUE". -For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +The `$true` automatic variable represents a value of "TRUE". For more information, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```powershell Set-ItemProperty -Path C:\GroupFiles\final.doc -Name IsReadOnly -Value $true @@ -115,7 +115,7 @@ NoOfEmployees : 824 ``` The first command creates the registry entry. -It uses **Path** to specify the path of the `HKLM:` drive and the "Software\MyCompany" key. +It uses **Path** to specify the path of the `HKLM:` drive and the `Software\MyCompany` key. The command uses **Name** to specify the entry name and **Value** to specify a value. The second command uses the `Get-ItemProperty` cmdlet to see the new registry entry. @@ -132,15 +132,9 @@ For more information about how to use PowerShell to manage the registry, type `G ### Example 3: Modify an item by using the pipeline -These commands show how to use a pipeline operator (`|`) to send an item to `Set-ItemProperty`. - -The first part of the command uses `Get-ChildItem` to get an object that represents the "Weekly.txt" -file. The command uses a pipeline operator to send the file object to `Set-ItemProperty`. -The `Set-ItemProperty` command uses the **Name** and **Value** parameters to specify the property -and its new value. - -This command is equivalent to using the **InputObject** parameter to specify the object that -`Get-ChildItem` gets. +Th example uses `Get-ChildItem` to get the `weekly.txt` file. The file object is piped to +`Set-ItemProperty`. The `Set-ItemProperty` command uses the **Name** and **Value** parameters to +specify the property and its new value. ```powershell Get-ChildItem weekly.txt | Set-ItemProperty -Name IsReadOnly -Value $True @@ -189,11 +183,13 @@ Accept wildcard characters: True ### -Filter -Specifies a filter to qualify the **Path** parameter. The [FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) -provider is the only installed PowerShell provider that supports the use of filters. You can find -the syntax for the **FileSystem** filter language in [about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). -Filters are more efficient than other parameters, because the provider applies them when the cmdlet -gets the objects rather than having PowerShell filter the objects after they are retrieved. +Specifies a filter to qualify the **Path** parameter. The +[FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) provider is the only +installed PowerShell provider that supports the use of filters. You can find the syntax for the +**FileSystem** filter language in +[about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). Filters are more efficient +than other parameters, because the provider applies them when the cmdlet gets the objects rather +than having PowerShell filter the objects after they are retrieved. ```yaml Type: System.String @@ -269,7 +265,8 @@ typed. No characters are interpreted as wildcards. If the path includes escape c it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. -For more information, see [about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). +For more information, see +[about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). ```yaml Type: System.String[] @@ -415,9 +412,9 @@ Accept wildcard characters: False ### CommonParameters -This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, -`-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, -`-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). ## Inputs @@ -431,13 +428,14 @@ You can pipe objects to this cmdlet. ### None, System.Management.Automation.PSCustomObject This cmdlet generates a **PSCustomObject** object that represents the item that was changed and its -new property value, if you specify the **PassThru** parameter. -Otherwise, this cmdlet does not generate any output. +new property value, if you specify the **PassThru** parameter. Otherwise, this cmdlet does not +generate any output. ## Notes `Set-ItemProperty` is designed to work with the data exposed by any provider. To list the providers -available in your session, type `Get-PSProvider`. For more information, see [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). +available in your session, type `Get-PSProvider`. For more information, see +[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). ## Related links @@ -456,4 +454,3 @@ available in your session, type `Get-PSProvider`. For more information, see [abo [Rename-ItemProperty](Rename-ItemProperty.md) [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md) - diff --git a/reference/7.2/Microsoft.PowerShell.Management/Set-ItemProperty.md b/reference/7.2/Microsoft.PowerShell.Management/Set-ItemProperty.md index 8db85599880a..a14c51c75e5e 100644 --- a/reference/7.2/Microsoft.PowerShell.Management/Set-ItemProperty.md +++ b/reference/7.2/Microsoft.PowerShell.Management/Set-ItemProperty.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 05/14/2019 +ms.date: 10/28/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Set-ItemProperty @@ -68,8 +68,8 @@ The file is a **System.IO.FileInfo** object and **IsReadOnly** is just one of it To see all of the properties, type `Get-Item C:\GroupFiles\final.doc | Get-Member -MemberType Property`. -The `$true` automatic variable represents a value of "TRUE". -For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). +The `$true` automatic variable represents a value of "TRUE". For more information, see +[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```powershell Set-ItemProperty -Path C:\GroupFiles\final.doc -Name IsReadOnly -Value $true @@ -115,7 +115,7 @@ NoOfEmployees : 824 ``` The first command creates the registry entry. -It uses **Path** to specify the path of the `HKLM:` drive and the "Software\MyCompany" key. +It uses **Path** to specify the path of the `HKLM:` drive and the `Software\MyCompany` key. The command uses **Name** to specify the entry name and **Value** to specify a value. The second command uses the `Get-ItemProperty` cmdlet to see the new registry entry. @@ -132,15 +132,9 @@ For more information about how to use PowerShell to manage the registry, type `G ### Example 3: Modify an item by using the pipeline -These commands show how to use a pipeline operator (`|`) to send an item to `Set-ItemProperty`. - -The first part of the command uses `Get-ChildItem` to get an object that represents the "Weekly.txt" -file. The command uses a pipeline operator to send the file object to `Set-ItemProperty`. -The `Set-ItemProperty` command uses the **Name** and **Value** parameters to specify the property -and its new value. - -This command is equivalent to using the **InputObject** parameter to specify the object that -`Get-ChildItem` gets. +Th example uses `Get-ChildItem` to get the `weekly.txt` file. The file object is piped to +`Set-ItemProperty`. The `Set-ItemProperty` command uses the **Name** and **Value** parameters to +specify the property and its new value. ```powershell Get-ChildItem weekly.txt | Set-ItemProperty -Name IsReadOnly -Value $True @@ -189,11 +183,13 @@ Accept wildcard characters: True ### -Filter -Specifies a filter to qualify the **Path** parameter. The [FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) -provider is the only installed PowerShell provider that supports the use of filters. You can find -the syntax for the **FileSystem** filter language in [about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). -Filters are more efficient than other parameters, because the provider applies them when the cmdlet -gets the objects rather than having PowerShell filter the objects after they are retrieved. +Specifies a filter to qualify the **Path** parameter. The +[FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md) provider is the only +installed PowerShell provider that supports the use of filters. You can find the syntax for the +**FileSystem** filter language in +[about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md). Filters are more efficient +than other parameters, because the provider applies them when the cmdlet gets the objects rather +than having PowerShell filter the objects after they are retrieved. ```yaml Type: System.String @@ -269,7 +265,8 @@ typed. No characters are interpreted as wildcards. If the path includes escape c it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. -For more information, see [about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). +For more information, see +[about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md). ```yaml Type: System.String[] @@ -415,9 +412,9 @@ Accept wildcard characters: False ### CommonParameters -This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, -`-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, -`-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). ## Inputs @@ -431,13 +428,14 @@ You can pipe objects to this cmdlet. ### None, System.Management.Automation.PSCustomObject This cmdlet generates a **PSCustomObject** object that represents the item that was changed and its -new property value, if you specify the **PassThru** parameter. -Otherwise, this cmdlet does not generate any output. +new property value, if you specify the **PassThru** parameter. Otherwise, this cmdlet does not +generate any output. ## Notes `Set-ItemProperty` is designed to work with the data exposed by any provider. To list the providers -available in your session, type `Get-PSProvider`. For more information, see [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). +available in your session, type `Get-PSProvider`. For more information, see +[about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md). ## Related links @@ -456,4 +454,3 @@ available in your session, type `Get-PSProvider`. For more information, see [abo [Rename-ItemProperty](Rename-ItemProperty.md) [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md) -