def get_system_sku(manufacturer=None): if not threading.current_thread() is threading.main_thread(): pythoncom.CoInitialize() try: my_sku = None w = WMI(namespace='WMI') for sku in w.MS_SystemInformation(["SystemSKU"]): my_sku = sku.SystemSKU if my_sku == None or my_sku == '': w = WMI() for sk2 in w.Win32_ComputerSystem(['OEMStringArray']): my_sku = sk2.OEMStringArray[1][2:6] if manufacturer and ("dell" in manufacturer.lower() or 'alienware' in manufacturer.lower()) and str( my_sku).strip() == 'None' or len(str(my_sku).strip()) != 4: print('Possibly wrong SKU on dell unit!') return my_sku except Exception as e: print(e) return None finally: if not threading.current_thread() is threading.main_thread(): pythoncom.CoUninitialize()