aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) #The following opens the registry to extract all software version numbers aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"\ , access=KEY_READ) bKey = OpenKey(aReg, r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"\ , access=KEY_READ) savfile = open(r’D:/Test/‘ + pathFin + '/' + result + ‘/Test/Software Versions.txt', 'a') savfile.write('All software versions extracted from ' + \ pcname +'\n' + '-----------------------------' + '\n') for i in range(100): try: asubkey_name = EnumKey(aKey, i) asubkey = OpenKey(aKey, asubkey_name) sofname = QueryValueEx(asubkey, "DisplayName") sofver = QueryValueEx(asubkey, "DisplayVersion") #print(sofname + sofver) outp = str(sofname + sofver) savfile = open(r’D:/Test/‘ + pathFin + '/' + result + ‘/Test/Software Versions.txt', 'a') savfile.write(outp + '\n') except FileNotFoundError: continue except OSError: savfile.close() break for a in range(100): try: bsubkey_name = EnumKey(bKey, a) bsubkey = OpenKey(bKey, bsubkey_name) sofFed = QueryValueEx(bsubkey, "DisplayName") outFed = str(sofFed) savfile = open(r’D:/Test/‘ + opathFin + '/' + result + ‘/Test/Software Versions.txt', 'a') savfile.write(outFed + '\n') savfile.close() except FileNotFoundError: continue except OSError: savfile.close() break
I query 2 locations in the registry to get all the software.
Just looking at that I have just realised I may not be giving the loop enough loops! I may increase that and see what happens. Although the GUID curly bracket entries are at the beginning of the registry entry.