I use this code to know if a key exists or not:
if RegKeyExists(HKEY_LOCAL_MACHINE, \'Software\\Autodesk\') then
Are you sure that Software\Autodesk\Maya is a registry key? Maybe it's just a value and you have to use RegValueExists.
Software\Autodesk\Maya
RegValueExists