you should use WMI to get this information. the registry key locations could (and did) change between windows versions.

here's the WMI command line to get the list:
C:\ wmic qfe list full

WMI also has a completely scriptable interface: http://msdn.microsoft.com/en-us/library/ms974579.aspx