This post will provide examples to explain the “Remove-ItemProperty” cmdlet.
How to Use the Remove-ItemProperty Cmdlet in PowerShell?
First, write the “Remove-ItemProperty” cmdlet to delete or remove a property. Then, specify the file or a registry key address to the “-Path” parameter. Next, use the “-Name” parameter to specify the property name that needs to be deleted. Consider the below-provided examples to know more about the “Remove-ItemProperty” cmdlet.
Example 1: Use the “Remove-ItemProperty” Cmdlet to Remove a Property of an Item
Before removing the property, let’s check if the property exists or not by executing the following command:
First, use the “Get-Item” cmdlet. Then, add the “-Path” parameter and assign it to the registry location where the registry key property is available:
The arrow in the above image is indicating the registry key confirms that the property exists.
Now, run the below-stated command to remove the corresponding property which is a registry key:
According to the above-stated command:
- First, use the “Remove-ItemProperty” cmdlet along with the “-Path” parameter having the registry location assigned.
- Next, utilize the “-Name” parameter and assign it the property to be removed:
After removing the property, let’s check if it was removed or not by utilizing the below command:
As it can be observed that the property has been removed successfully.
Example 2: Use the “Remove-ItemProperty” Cmdlet to Remove a Registry Value with the Pipe Operator
Execute the provided command to remove an item’s property by utilizing the pipe operator:
Here:
- First, use the “Get-Item” cmdlet, then add the “-Path” parameter and assign it the corresponding path where the property is residing.
- Next, pipe the command to the “Remove-ItemProperty” cmdlet, along with the “-Name” parameter having the assigned parameter name that needs to be removed:
That’s all! You have learned about the “Remove-ItemProperty” cmdlet in PowerShell.
Conclusion
To remove a property and its value from an item, the “Remove-ItemProperty” cmdlet can be used in PowerShell. It also removes the registry values and the data they store. This blog described the “Remove-ItemProperty” cmdlet in detail with the help of various examples.