Syntax error How to delete registry key value (property) using PowerShell?

How to delete registry key value (property) using PowerShell?



To delete the registry key value using PowerShell, we can use the Remove-ItemProperty command. Suppose we have the registry NodeSoftware and its Property is AppSecurity. We need to delete its key using the Remove-ItemProperty command.

PS C:\> Get-Item HKLM:\SOFTWARE\NodeSoftware
Hive: HKEY_LOCAL_MACHINE\SOFTWARE
Name    Property
----    --------
NodeSoftware    AppSecurity : 1

To delete the registry key,

PS C:\>Remove-ItemProperty HKLM:\SOFTWARE\NodeSoftware\ -Name AppSecurity -Force -Verbose
VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\NodeSoftware\ Property: AppSecurity".

You can also delete property by setting the location. For example,

Example

PS C:\> Set-Location HKLM:\SOFTWARE\NodeSoftware
PS HKLM:\SOFTWARE\NodeSoftware> Remove-ItemProperty -Path . -Name AppSecurity -Force -Verbose

To remove Item property using Pipeline,

Get-Item HKLM:\SOFTWARE\NodeSoftware | Remove-ItemProperty -Name AppSecurity -Force -Verbose
Updated on: 2021-02-08T07:28:37+05:30

13K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements