Requests for Automation

Find registry keys and delete if search string is found

I can find them but I can't get it to delete. Example below. C:\Windows\system32>SET KEY=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services C:\Windows\system32>SET VALUE=Bomgar C:\Windows\system32>for /F "tokens=1,*" %a in ('REG QUERY "%KEY%" ^| findstr /I /C:"bomgar"') do (REG DELETE "%KEY%" /v %a) C:\Windows\system32>(REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Ser vices" /v HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\bomgar-ps-57F774 F4-1480073003 ) Delete the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\b omgar-ps-57F774F4-1480073003 (Yes/No)? y ERROR: The system was unable to find the specified registry key or value. C:\Windows\system32>(REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Ser vices" /v HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\bomgar-ps-5867F2 06-1503994339 ) Delete the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\b omgar-ps-5867F206-1503994339 (Yes/No)? y ERROR: The system was unable to find the specified registry key or value. C:\Windows\system32>(REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Ser vices" /v HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\bomgar-ps-59D751 25-1508425243 ) Delete the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\b omgar-ps-59D75125-1508425243 (Yes/No)? y ERROR: The system was unable to find the specified registry key or value.

Discussion
Gravatar for Roy Herron
Roy Herron 10 months ago

Have you thought about creating a simple agent procedure to do this?

If hasRegistryKey ("name and path of registry key")
executeShellCommand("reg delete "Registry_key_path /v Registry_value_name", "Execute as System in 64-bit shell", "All Windows Operating Systems", "Halt on Fail")

Gravatar for Jamie
Jamie 8 months ago

I have actually searched for this exact same thing and found no solution. Stupid Bomgar registry keys are all different making it impossible to clean up registry via script. I contacted Bomgar and apparently their dev team is working on a uninstall tool but last time I contacted them it was still not available. If you figure this out that would be awesome.

Details

  • 2 Votes
  • 2 Comments
  • Open for about 1 year
  • Created by Jack Senesap