Removing registry keys and values

Last modified by Sabrina V. on 2024/10/08 11:35

Initial situation

If you want to remove a registry key or value from one of your Clients, you need to find it specifically. This can be difficult if you do not know which Clients the value or key was set on in the past.  To avoid this problem, you can create a Client Command that checks whether such a value or key is generally available on the Client that you want to optionally remove.

This use case explains how to check whether a particular registry key or value exists and how to remove it in the Command. Both sections can be used independently. Proceed as follows:

Remove registry key

Select Script

  1. Navigate to the Client Commands > Create module.
  2. Click Add on the ribbon bar. The Client Command Editor will open and you will need to decide whether it is a Console or Client Script. In this case select Client Script.

Adding and customising the If registry key (not) exists Command

  1. Select the Condition > If registry key (not) exists Command from the Command List.
  2. Double click to open the Command.
  3. In the Details tab, under Commands, select If key exists.
  4. Under Registry, ensure that HKEY_LOCAL_MACHINE is selected under the root key.

    Hinweis  Note:  

    The root key specifies the folder path where the registry key is located. 

  5. Enter the value you want to check under the key. You can either enter this key manually or search for it using the icon on the pages. In this example, the ACMP Web Interface is used as the key (\SOFTWARE\WOW6432Node\Aagon\ACMP Web Interfaces).
  6. Click OK when you are done.
    The first line of the Command appears.

642_Use Case Client Command_Wenn Registryschlüssel (nicht) existiert_538.png

Customised Command If registry key (not) exists

Select and edit the Delete registry key or value Command

  1. Navigate back to the Command List and double click Registry > Delete registry key or value.
  2. Select the Details tab.
  3. Select HKEY_LOCAL_MACHINE under the root key.
  4. Type the value you want to delete under the key. You can either enter this key manually or search for it using the icon on the pages. In this example, the ACMP Web Interface is used as the key (\SOFTWARE\WOW6432Node\Aagon\ACMP Web Interfaces).
  5. Activate the Delete key combo box under Actions. This is the only way to execute the Command correctly, as it removes the entire registry key.
  6. Click OK to display the Command in line 2.

    Hinweis  Note:  

    ndent this Command either using the quick selection bar or the shortcut CTRL + -> so that it appears below the first Command (If the registry key (not) exists). When adding this Command, you can also simply drag the Command onto the line of the previous Command so that it is properly integrated.

  7. Save the Client Commands if you do not wish to make any further changes to the content.

642_Use Case Client Command_Registryschlüssel oder Wert löschen_518.png

Custom Command Delete registry key or value

At this point the Client Command is complete and can be used if you wish to delete registry keys. Save the Command and continue with the Client Command phases.

642_Use Case Client Command_Registrykey entfernen_1661.png

Client Command Editor: Identifying and removing registry keys

Running through the Client Command phases

Finally, the Client Command must go through the Test, Synchronise, Release and Execute phases before it can be used. Only then will it check that the registry key exists on your Clients, so that it can be deleted at the same time.

Remove registry value

Select Script

  1. Navigate to the Client Commands > Create module.
  2. Click Add on the ribbon bar. The Client Command Editor will open and you will need to decide whether it is a Console or Client Script. In this case select Client Script.

Adding and customise the Command If registry value name (not) exists

  1. First select the Condition > If registry value name (not) exists Command from the Command List.
  2. Double click to open the Command.
  3. Select If value name exists under the Details tab.
  4. Select the HKEY_LOCAL_MACHINE root key in the registry, if it is not already selected.

    Hinweis  Note:  

    The root key specifies the folder path where the registry value is to be found. 

  5. Enter the key where the value to be deleted is located. In this example, ACMP is used (\SOFTWARE\WOW6432Node\Aagon\ACMP).
  6. Enter the name of the value. If you know the name of the value, you can either type it manually or look it up using the icon on the page. In this case it will be ActiveLevel.
  7. Click OK when finished.
    The first line of the Command appears.

642_Use Case Client Command_Wenn Registry Wertename (nicht) exisitiert_484.png

Customised Command If registry value name (not) exists

Select and edit Delete registry key or value Command

  1. Navigate back to the Command List and double click the Registry > Delete registry key or value Command.

    Hinweis  Note:  

    Indent this Command either using the quick selection bar or the CTRL + -> shortcut so that it appears below the first Command (If the registry key (not) exists). When adding this Command, you can also simply drag the Command onto the line of the previous Command so that it is properly integrated.

  2. Select the Details tab.
  3. Select HKEY_LOCAL_MACHINE under the root key, if this has not already been done.
  4. Enter the value you want to delete under the key. The key should be ACMP (\SOFTWARE\WOW6432Node\Aagon\ACMP).
  5. Insert the name of the value. Either type it in manually or look it up using the icon on the pages. In this case it will be ActiveLevel.
  6. Activate the Delete Value combo box under Actions. You need to do this to delete the value from the registry.
  7. Click OK to display the Command in second row.
  8. Save the Client Commands if you do not want to make any further changes to the content.

642_Use Case Client Command_Registryschlüssel oder Wert löschen (Registrywert löschen)_496.png

Custom Command Delete registry key or value

The two Commands now allow you to check that the relevant registry value exists and also to remove it. Save the Command and proceed to the Client Commands phases.

642_Use Case Client Command_Registrywert entfernen_1661.png

Client Command Editor: Find and remove registry value

Running through the Client Command phases

Finally, the Client Command must go through the Test, Synchronise, Release and Execute phases before it can be used. Only when the Client Command has been released can it be deployed in Containers or directly to Clients.

© Aagon GmbH 2024
Besuchen Sie unsere neue Aagon-Community