Registry.Key.Delete
Top  Previous  Next


Deletes registry key (also possible to delete all subkeys)

Please make sure to backup the registry before doing any changes.

Category
Registry

Script section
All

Registry.Key.Delete HKEY, ParentKey, KeyToDelete [,Recursive]

HKEY

Options: HKEY_LOCAL_MACHINE | HKEY_USERS | HKEY_CURRENT_USER  
Notice: HKEY_CURRENT_USER requires Remote admin service  

ParentKey
Name of key to delete key in  

KeyToDelete
Name of key to delete  

Recursive [Optional parameter]
Options: Recursive |  
·Recursive - causes the command to automatically delete key and subkeys  
·Nothing - blank parameter - halt with an "#5 Access is denied" error if key contains subkeys  

Other parameters
This command is executed on the current machine in the [Machines] section.  

Example
Delete "myKey" in hkey_local_machine\software
Registry.Key.Delete hkey_local_machine, software, myKey

Delete "myKey" and all subkeys of "myKey" in hkey_local_machine\software
Registry.Key.Delete hkey_local_machine, software, myKey, Recursive