2

I know that I can download the official Windows 10 Pro ISO image by using the Media Creation Tool that Microsoft provides on their website: https://www.microsoft.com/en-us/software-download/windows10

However, this program ("MediaCreationTool1809.exe") does not appear to have any command-line options. Thus, I must manually click through the wizard in order to download the ISO.

Is there a way to automatically download the Windows 10 ISO via some sort of command-line process? I want to run a script to check for the latest version of Windows 10 Pro and then, if there is a new version, automatically download it.

2 Answers 2

2

As far as I'm aware, this is not possible.

Microsoft only packages their Windows 10 ISOs per major release. This usually happens every couple of months. For example, with their October 2018 and April 2018 updates.

Additionally, it is not required that you use the Media Creation Tool. The Media Creation Tool only appears if your browser uses a Windows browser agent (read: a browser identifier). If you spoof your browser agent to one of another operating system (i.e. macOS) or if you go to the Windows 10 portion of the MS website from a computer of another platform, it is entirely possible to arrive at this screen.enter image description here

From here, what you can do is select the edition/version and language and download. Sounds simple enough, right? Just a simple query to see if the drop-down dialog box has anything new and if not, then go for the latest version with a simple pull command, right?

Well, it would be. However, Microsoft generates personalized download links for each combination of ISO. What that means is that these links that are generated expire 24 hours from their creation, making anything like that next to impossible unless someone here other than me manages to find a link from a source other than Microsoft with the ISOs that doesn't expire.

TL;DR - Because Microsoft expires their download links after 24 hrs, it is most likely not going to work by having a command line script pull down the Windows 10 ISO automatically.

1

As a partial answer, you can use a Python script to at least check to see if you already have the latest version of Windows 10 downloaded:

# Microsoft only releases a new Windows 10 ISO when they do a big update every 6 months or so.
# This script will check the Microsoft web page to see if there is a new version.
# We cannot automatically download it because Microsoft provides custom-made links that expire after
# 24-hours.

# Configuration
ISO_DOWNLOAD_URL = 'https://www.microsoft.com/en-us/software-download/windows10ISO'

# Imports
import os
import requests
import sys
import webbrowser
from bs4 import BeautifulSoup

r = requests.get(ISO_DOWNLOAD_URL)
html = r.text.encode("utf-8")
soup = BeautifulSoup(html, 'html.parser')

# Compile a list of the current Windows 10 Editions
# We use BeautifulSoup to parse the HTML
# https://www.crummy.com/software/BeautifulSoup/
# We are looking for the following code:
'''
<select id="product-edition" href="#product-info-content">
    <option value="" selected="selected">Select edition</option>
    <optgroup label="Windows 10 October 2018 Update">
        <option value="1060">Windows 10</option>
    </optgroup>
    <optgroup label="Windows 10 April 2018 Update">
        <option value="651">Windows 10</option>
    </optgroup>
</select>
'''
most_recent_windows_edition = ''
for select in soup.find_all('select'):
    if select['id'] != 'product-edition':
        continue

    for optgroup in select.find_all('optgroup'):
        most_recent_windows_edition = optgroup['label']
        break

if most_recent_windows_edition == '':
    print('Failed to find the most recent Windows 10 edition in the retrieved HTML.')
    sys.exit(1)
print('The most recent version is: ' + most_recent_windows_edition)

# Get the directory of the script
# https://stackoverflow.com/questions/4934806/how-can-i-find-scripts-directory-with-python
DIR = os.path.dirname(os.path.realpath(__file__))

# Look to see if there is a directory for this edition already
if os.path.isdir(os.path.join(DIR, most_recent_windows_edition)):
    print('This version has already been downloaded.')

print('Still need to get this version. Use a user-agent switcher and switch to Linux to get the right ISO.')
webbrowser.open_new(ISO_DOWNLOAD_URL)

In order to achieve automatic downloading, this script could be extended with a headless browser like Selenium in order to emulate clicking through the prompts. I don't have the time to do all of that, but it is possible.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .