https://github.com/p0dalirius/pysortwindowsisos
Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files.
https://github.com/p0dalirius/pysortwindowsisos
build iso parse python windows
Last synced: about 2 months ago
JSON representation
Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files.
- Host: GitHub
- URL: https://github.com/p0dalirius/pysortwindowsisos
- Owner: p0dalirius
- Created: 2022-01-19T16:55:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T11:29:00.000Z (about 1 year ago)
- Last Synced: 2025-08-17T05:41:33.203Z (about 2 months ago)
- Topics: build, iso, parse, python, windows
- Language: Python
- Homepage: https://podalirius.net/
- Size: 172 KB
- Stars: 16
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README

Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files.
![]()
![]()
![]()

## Features
- [x] Parse multiple ISO files from a directory.
- [x] Detect the Windows build number and OS language.
- [x] Sort and rename the ISO files in folders by OS major and minor builds.## Examples
- **Automatically sort and rename the isos from a directory by major and minor build numbers.**
```
./SortWindowsISOs.py --iso-dir ./isos/ --archive-dir ./archive/
```
- **Only get the major and minor build numbers of an ISO.**
```
./SortWindowsISOs.py --iso ./isos/Win10_21H1_x64_English.iso
```## Usage
```
$ ./SortWindowsISOs.py -h
usage: SortWindowsISOs.py [-h] (-i ISO | -d ISO_DIR) [-a ARCHIVE_DIR] [-v]Extract Windows Build number from ISO files. v1.1
optional arguments:
-h, --help show this help message and exit
-i ISO, --iso ISO Path to iso file.
-d ISO_DIR, --iso-dir ISO_DIR
Directory containing multiple ISOs to parse.
-a ARCHIVE_DIR, --archive-dir ARCHIVE_DIR
Archive dir. (default: False)
-v, --verbose Verbose mode. (default: False)```
## How it works
In order to extract the Windows version from an ISO, we first need to mount the ISO file and open its content. In the ISO, there is a `./sources/` folder containing a `Windows imaging (WIM) image` in `./sources/boot.wim`. When we uncompress this archive, we get a lot of files, but one file at the root of the archive stands out: `'[1].xml'`.
```
boot$ ls -lha
total 52K
drwxrwxr-x 5 podalirius podalirius 4,0K janv. 18 00:17 .
drwxrwxr-x 4 podalirius podalirius 4,0K janv. 18 00:17 ..
drwx------ 8 podalirius podalirius 4,0K mars 19 2019 1
-rw-rw-r-- 1 podalirius podalirius 3,9K janv. 18 00:16 '[1].xml'
drwx------ 8 podalirius podalirius 4,0K mars 19 2019 2
drwx------ 2 podalirius podalirius 32K janv. 18 00:16 '[DELETED]'
```This file is a XML file containing information about the images contained inside the `./sources/install.wim` file. It contains all the information we need to know which major or minor build this ISO file is. Here is an extract of the [`'[1].xml'`](./example/%5B1%5D.xml) file:
```xml
4461218778
...
9
Microsoft® Windows® Operating System
ServerStandardEval
Server Core
0
10.0.17763.719;2016-01-01T00:00:00Z
IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE
ServerNT
Enterprise
en-US
en-US
10
0
17763
737
0
rs5_release
WINDOWS
Windows Server 2019 SERVERSTANDARDCORE
Windows Server 2019 SERVERSTANDARDCORE
ServerStandardEvalCore
Windows Server 2019 Standard Evaluation
(Recommended) This option omits most of the Windows graphical environment. Manage with a command prompt and PowerShell, or remotely with Windows Admin Center or other tools.
...```
## Contributing
Pull requests are welcome. Feel free to open an issue if you want to add other features.