Home » How to Delete Registry Value in PowerShell

How to Delete Registry Value in PowerShell

PowerShell provides a built-in cmdlet Remove-ItemProperty to delete a registry value.

The following method can be used to remove a registry value in PowerShell.

Method 1: Delete a registry value in PowerShell

# Specify the path to the registry key
$registryPath = "HKLM:\Software\SysApp"

# Delete a registry key
Remove-ItemProperty -Path $registryPath -Name SysKey -Force -Verbose

This example deletes a registry value of the SysApp key.

The following example shows how to use this method to remove a registry value in PowerShell.

Delete a Registry Value in PowerShell

To delete a registry value in PowerShell, you can use the Remove-ItemProperty cmdlet. This command uses the -Path parameter to specify the registry key path and the -Name parameter to specify the registry key.

# specify the path to the registry key
$registryPath = "HKLM:\Software\SysApp"

# Delete registry value
Remove-ItemProperty -Path $registryPath -Name SysKey -Force -Verbose

# Retrieve the registry key
Get-Item -Path $registryPath

Output:

PowerShell delete a registry value
Delete a registry value in PowerShell

In this example, the Remove-ItemProperty cmdlet deletes the registry value specified by the -Name parameter (SysKey) forcefully.

The Get-Item command is used to get the registry key information from the specified `$registryPath` variable.

Conclusion

I hope the above article on deleting a registry value in PowerShell using the Remove-ItemProperty cmdlet is helpful to you.

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.