brittonv
asked on
Search for Values in a registry key and delete them
I am trying to create a powershell script that will delete all entries where the word apple is.
I can get to the HK users using example:
I am starting to think that it isn't possible.
if it can't be done 'cleanly', can a script output to a text file then another script use taht file to delete the entries? I would prefer if it could be done with a single script but I am starting to give up....
I can get to the HK users using example:
$null = New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS
Get-ChildItem HKU:'\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\Devices'
However how do I loop throgh those values and delete the ones that say "apple"???I am starting to think that it isn't possible.
if it can't be done 'cleanly', can a script output to a text file then another script use taht file to delete the entries? I would prefer if it could be done with a single script but I am starting to give up....
ASKER
This is beyond awesome, thanks!
One more question, is it possible to convert something like this in to a function such that I could run:
delkey -key "HKU:\S-1-5-20\Software\Mi crosoft\Wi ndows NT\CurrentVersion\Devices" -value "apples"
I understand that I would have to mount HKU first.
One more question, is it possible to convert something like this in to a function such that I could run:
delkey -key "HKU:\S-1-5-20\Software\Mi
I understand that I would have to mount HKU first.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome, thanks!!!
Open in new window