Already a NinjaOne customer? Log in to view more guides and the latest updates.

Delete a Registry Key Using a Custom Script

 

NinjaDojo-logo-darkblue.jpg

 

The reg command allows us to delete registry keys and registry values from command line. This reg command can also be used from batch files - to do so, you can add this as a .bat script to your Script Library, and can then run it on devices using a Scheduled Script, using a Scheduled Task, or ad-hoc (from the play button on the device page, or from the Search tab).

The syntax for the delete operation is explained below with examples.

Delete a registry Value:

reg delete Registry_key_path /v Registry_value_name

The 'Registry_key_path' as an example the ninja agent key path is as follows:

HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeNinjaRMM LLCNinjaRMMAgent

The 'Registry_value_name' is the name of the actual registry key - as an example, it is 

the value '1033' in this scenario.

 ** if you want to delete registry key without being prompted for confirmation then add /f **

Important Note: Please also see our Remote Tools for information about our remote registry tool. 

FAQ

Next Steps