Cannot Delete Sonic Wall Registry Keys

194 Views Asked by At

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
1

There are 1 best solutions below

5
On

Yes, you can remove the subkeys recursively using it. I am explaining in details:

Get-ChildItem can perform complex filtering capabilities

Get-ChildItem -Path "HKLM:\SOFTWARE\Sonicwall -Recurse 

would 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.

Remove-Item -Path HKLM:\SOFTWARE\Sonicwall

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 :

Remove-Item -Path HKLM:\SOFTWARE\Sonicwall\* -Recurse

Since you are looking for removal in one single shot with subkeys and everything, then you can use -Force for the same:

Remove-Item -Path HKLM:\SOFTWARE\Sonicwall -recurse -Force

Hope it gives you some idea on what you should be doing next.