Deleting a Registry KEY not Value

(imported topic written by balexph3291)

Can anyone assist me with deleting a registry KEY for example:

I would like to delete the following products key not value, HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products

I have tried the following:

regdelete " [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products]" it works great for value but not for key…

Brian

(imported comment written by NoahSalzman)

You might want to try the method described in this thread:

http://forum.bigfix.com/viewtopic.php?id=2015

(imported comment written by balexph3291)

Thanks, but I know their must be a simple way to just delete a registry key!!

(imported comment written by dgaynor91)

This works:

DOS reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\VIRUSCAN8000” /f

(imported comment written by balexph3291)

I tried the following DOS reg delete command on the system with no success. It completed but didn’t delete the registry key that followed. If you have any ideal why it didn’t delete the key, it is really needed!!

Thanks for the suggestions!!

(imported comment written by BenKus)

balexph32,

The method that Noah mentioned (http://forum.bigfix.com/viewtopic.php?pid=8685#p8685) is the recommended way to delete a reg key.

Ben

(imported comment written by balexph3291)

Ben,

I, tested the following method that was mentioned by Noah, with no success. Can you assist with another example that I can try. I know you have to create the del.reg file, which can be created with the appendfile.

Brian

(imported comment written by BenKus)

Hey Brian,

Please post the code you tried… The example I gave should be correct…

Ben

(imported comment written by balexph3291)

Hey Ben,

I posted the code the Action Details,

delete __appendfile

delete regdel.reg

appendfile REGEDIT4

appendfile

-HKEY_CLASSES_ROOT\CLSID{D51BD5A3-7548-11CF-A520-0080C77EF58A}

move __appendfile regdel.reg

wait regedit /s regdel.reg

Action Script Execution Details

Completed delete __appendfile

Completed delete regdel.reg

Completed appendfile REGEDIT4

Failed appendfile

-HKEY_CLASSES_ROOT\CLSID{D51BD5A3-7548-11CF-A520-0080C77EF58A}

move __appendfile regdel.reg

wait regedit /s regdel.reg

(imported comment written by BenKus)

Hey Brian,

Ah… You are hitting the old escaping “{” problem… “{” is a special character in actionscript because that is how you embed relevance… Add another “{” to escape it:

delete __appendfile
delete regdel.reg
appendfile REGEDIT4
appendfile -HKEY_CLASSES_ROOT\CLSID{{D51BD5A3-7548-11CF-A520-0080C77EF58A}
move __appendfile regdel.reg
wait regedit /s regdel.reg

Ben

(imported comment written by balexph3291)

Thanks,

That really helped me out!! I’m rather new with Big Fix is it possible to break down each line of the script and explain what’s happening?

Brian

(imported comment written by BenKus)

Hey Brian,

Sure… see comments below…

// basically these two delete lines are here for safety just-in-case a file with the same name already exists… It is
// ahabit we got into to avoid rare errors, but mostly not necessary
delete __appendfile
delete regdel.reg

// the next two appendfile lines simply make a file “__appendfile” with this information
appendfile REGEDIT4
appendfile -HKEY_CLASSES_ROOT\CLSID{{D51BD5A3-7548-11CF-A520-0080C77EF58A}

// we now rename the “__appendfile” to "regdel.reg"
move __appendfile regdel.reg

// we now run “regedit /s” that is the command to import into the registry and feed it the file we made…
wait regedit /s regdel.reg

Arguably we could simplify this to remove a few lines, but the previous way should be slightly less error prone:

appendfile REGEDIT4
appendfile -HKEY_CLASSES_ROOT\CLSID{{D51BD5A3-7548-11CF-A520-0080C77EF58A}
wait regedit /s __appendfile

Ben

(imported comment written by NoahSalzman)

Also, if you want more information about how to use the ActionScript commands “wait”, “appendfile”, and “move” then you should checkout these two resources:

http://support.bigfix.com/bes/misc/customactions.html

http://support.bigfix.com/fixlet/documents/WinActions_20081110.pdf

(imported comment written by balexph3291)

Thanks!!