I'm trying to delete leftover Sonic Wall registry keys. I keep getting the error
"Cannot delete a subkey tree because the subkey does not exist"
The key has children but should the Recurse parameter handle this whole deletion? Registry Screenshot
I'm using this PowerShell command
Remove-Item -Path "HKLM:\SOFTWARE\Sonicwall" -recurse
Yes, you can remove the subkeys recursively using it. I am explaining in details:
Get-ChildItem
can perform complex filtering capabilitieswould help you to atleast list down all the items that you want to delete.
The next thing you can do after confirming is pipe it further to
Remove-item
. That way you know what is being deleted.You can remove contained items by using
Remove-Item
, but you will be prompted to confirm the removal if the item contains anything else.This item has children and since you have not given -recurse. So you need to choose according to the options that would prompt.
However, if you do not wish to get the prompt and delete first all the items within but the HKLM:\SOFTWARE\Sonicwall, then what you can do is :
Since you are looking for removal in one single shot with subkeys and everything, then you can use
-Force
for the same:Hope it gives you some idea on what you should be doing next.