Here an example for using the reg command in a logof script:
http://www.ehow.com/how_8034635_remove-registry-entry-logoff-script.html
I believe you should be able to create a .cmd script and use within the REG commands to remove the invalid/old registry entries:
reg delete "HKCU\Some\Registry\Path" /f
or
reg delete "HKLM\Some\Registry\Path" /f