I'm trying to get the Windows version (10 or 11 in this case) of one of its windows update file by reading the metadata in Python. I've tried numerous ways, but they all seemed to fail.
Is there any way to get the intended Windows Version from its file (.msu .msi .cab .msp
) without relying on the file name?
I'm getting these files from Windows Update Catalog, search "windows 10" or "windows 11".
From the filesystem metadata? No.
CAB (cabinet) files are archives, much like a ZIP file, that hold compressed copies of multiple files. The information you seek would not be part of the CAB metadata, but would be in a file (or files) within the CAB itself. Also, a single CAB could contain some files to be used for a Windows 10 update and another set of files for a Windows 11 update. So there may not even be an answer that applies to the CAB as a whole.
MSI (Microsoft installer) files are essentially databases describing what needs to be done to install a product (or update). If you knew how to access the right table in the database, you could, in many cases, figure out what the prerequisites are. But it's not that simple in the general case, as MSIs may include (or reference) custom scripts or even DLLs that do ad-hoc checking of prerequisites (among other things).
I'm not familiar with the other two file formats (MSU and MSP), but I doubt your likely to find the information you seek in their filesystem metadata.