user2804597
user2804597

Reputation: 83

powershell removing a specific registry key

I am new to PowerShell and I am trying to remove a specific value from the run registry key. I am using the remove-item command, however, I don't see a switch to specify a single value. I don't want to remove the entire key, just one value.

For reference the batch equivalent of what I am trying to do:

reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v SunJavaUpdateSched /f

Upvotes: 8

Views: 41678

Answers (2)

TheFallenTech
TheFallenTech

Reputation: 360

Remove-ItemProperty -Name 'nameofkeyentry' -Path 'pathtothekey'

For example the key 'HKCU:\Accessibility\AudioDescription' has 3 values


(Default) REG_SZ (value not set)
Locale    REG_SZ [blank]
On        REG_SZ 0

Suppose we would like to remove the 3rd value 'On' - we would do so as follows

Remove-ItemProperty -Name 'On' -Path 'HKCU:\Accessibility\AudioDescription'

note HKCU stands for HKEY_CURRENT_USER, each root is abbreviated intuitively the same way (e.g. HKEY_CLASSES_ROOT = HKCR:\, etc)

Upvotes: 20

Tekno Sal
Tekno Sal

Reputation: 97

use the cmdlet remove-itemproperty

Upvotes: 1

Related Questions