tis-windows10-2004-upgrade

10.0.19041-76
Upgrade to the latest version of Windows 10 from Windows 7, 8 and 10 - You must execute the "update-package" and "build-package" for every single necessary language before deploying the package
104 downloads
Download

  Description 

  • package : tis-windows10-2004-upgrade
  • version : 10.0.19041-76
  • architecture : x64
  • categories : System and network
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : Upgrade to the latest version of Windows 10 from Windows 7, 8 and 10 - You must execute the "update-package" and "build-package" for every single necessary language before deploying the package
  • locale : en
  • target_os : windows
  • min_wapt_version : 1.8.2
  • sources : https://www.microsoft.com/software-download/windows10
  • installed_size : 25000000000
  • impacted_process : SetupHost
  • description_fr : Mise à niveau vers la dernière version de Windows 10 à partir de Windows 7, 8 et 10 - Vous devez exécuter le "update-package" et le "build-package" pour chaque langue nécessaire avant de déployer le paquet
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : Microsoft
  • licence : Proprietary
  • signature_date : 2021-06-23T15:07:03.886304
  • Homepage : https://www.microsoft.com/software-download/windows10
  • Conflicts :

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform

""" 
Installation procedure: 
https://docs.microsoft.com/en-us/archive/blogs/home_is_where_i_lay_my_head/windows-10-setup-command-line-switches

"""

# Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_name = "MediaCreationTool2004.exe"
url_dl = "https://software-download.microsoft.com/download/pr/%s" % bin_name
upgrade_path = makepath(systemdrive, 'WindowsUpgrade')
upgrade_logs_path = makepath(systemdrive, 'WindowsUpgradeLogs')
# Please verify the following values:
Arch = "x64"                    # Usable values: x64 or x86
Edition = "Professionnal"       # Usable values: Enterprise, Enterprise N, Education, Education N, Professional, Professional N
Lang = "en-US"                  # https://docs.microsoft.com/windows-hardware/manufacture/desktop/available-language-packs-for-windows
upgrade_windows_version_to = Version('10.0.19041', 3)


def install():
    # Declaring local variables
    package_version = control.version.split('-')[0]
    upgrade_windows_version_to = package_version
    iso_path = makepath(basedir, 'iso')

    # Copying files
    if Version(windows_version()) < Version(upgrade_windows_version_to):
        print("Free disk space: %d bytes" % get_disk_free_space(systemdrive))
        if get_disk_free_space(systemdrive) < 6000000000 :
            error("Not enough free space for copying upgrade data, please cleanup")

        if not isdir(upgrade_path):
            print("Creating %s for Windows 10 version %s" % (upgrade_path,upgrade_windows_version_to))
            mkdirs(upgrade_path)
            copytree2(iso_path,upgrade_path)

        if not isdir(upgrade_logs_path):
            mkdirs(upgrade_logs_path)

    # Checking versions before upgrade
    if Version(package_version, 3) != Version(upgrade_windows_version_to, 3):
        error("ERROR: Please make sure that you are trying to upgrade to the correct version: (%s) or (%s)?" % (upgrade_windows_version_to, package_version))

    # Upgrading Windows 10 if needed
    if Version(windows_version()) < Version(upgrade_windows_version_to):
        if isdir(upgrade_path):
            print("%s folder exists, continuing..."  % upgrade_path)
            print("Free disk space: %d bytes" % get_disk_free_space(upgrade_path))
            if get_disk_free_space(upgrade_path) < 25000000000:
                error("Not enough free space on disk for upgrade, please cleanup")
            else:
                if not force:
                    try:
                        print("Upgrading Windows 10 version to: %s" % upgrade_windows_version_to)
                        run(r'"%s" /auto upgrade /quiet /showoobe none /noreboot /dynamicupdate disable /telemetry disable /copylogs "%s"' % (makepath(upgrade_path, "setup.exe"), makepath(upgrade_logs_path, "win10_upgrade_logs")), timeout=5000)
                    except Exception as error_upgrade:
                        print(error_upgrade)
                else:
                    try:
                        print("Force Upgrading Windows 10 version to: %s" % upgrade_windows_version_to)
                        #r'"%s" /auto upgrade /quiet /showoobe none /noreboot /dynamicupdate enable /telemetry disable /copylogs "%s"'
                        run(r'"%s" /auto upgrade /quiet /copylogs "%s"' % (makepath(upgrade_path, "setup.exe"), makepath(upgrade_logs_path, "win10_force_upgrade_logs")), timeout=5000)
                    except Exception as error_force_upgrade:
                        print(error_force_upgrade)
        else:
            error("%s do not exist, please reinstall this package" % upgrade_path)
    else:
        print("This PC is already up-to-date on Windows 10 version: %s" % windows_version())


def uninstall():
    # Uninstalling the package
    if isdir(upgrade_path):
        print("Removing: %s" % upgrade_path)
        remove_tree(upgrade_path)
    if isdir(upgrade_logs_path):
        print("Removing: %s" % upgrade_logs_path)
        remove_tree(upgrade_logs_path)


def audit():
    # Auditing the package
    if Version(windows_version()) < Version(upgrade_windows_version_to):
        print("Windows 10 upgrade failed")
        return "ERROR"
    else:
        print("This PC is now up-to-date on Windows 10 version: %s" % windows_version())
        if isdir(upgrade_path):
            print("Cleaning up since the upgrade was successful...")
            print("Removing: %s" % upgrade_path)
            remove_tree(upgrade_path)
        if isdir(upgrade_logs_path):
            print("Removing: %s" % upgrade_logs_path)
            remove_tree(upgrade_logs_path)
        return "OK"


def update_package():
    '''
    Method 1:
    1- Place your desired Windows 10 ISO in the package and run the update_package function
    2- Build-upload the package

    Method 2:
    1- Run the update_package function to Launch the Microsoft MediaCreationToolxxxx and Download the latest Windows 10 iso file (save it in the package)
    2- Build-upload the package
    '''

    # Ignoring auto-builder
    if get_hostname().split('.')[0].lower() == 'build-w10':
        print("%s is skipped" % get_hostname().split('.')[0].lower())
        return "END"

    messagebox(control.package, "Please make sure that you have placed the Windows 10 ISO of the desired version in the package directory before continuing.\nIf not, you will be prompted to build an ISO with the official Windows 10 Media Creation Tool.")

    # Initializing variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    iso_path = makepath(basedir, 'iso')
    setup_path = makepath(iso_path, 'setup.exe')

    # Detect ISO if placed
    iso_used = False
    for iso_in_dir in glob.glob('*.iso'):
        if isfile(iso_in_dir):
            iso_used = True

    # Detect ISO if already extracted
    iso_extracted = False
    if isfile(setup_path):
        iso_extracted = True

    # Downloading latest MediaCreationTool
    if not iso_used:
        remove_file(bin_name)
        print("Downloading {}".format(bin_name))
        wget(url_dl,bin_name,proxies=proxies)
        print("please make sure that this copy of Windows is activated to be able to complete the process.")
        # Getting version from MCT
        mct_version = get_file_properties(bin_name)['ProductVersion']

    # Check if the extracted ISO is older
    if iso_extracted and not iso_used:
        actual_iso_version = get_file_properties(setup_path)['ProductVersion']
        if actual_iso_version < mct_version:
            print('Removing: {}'.format(iso_path))
            remove_tree(iso_path)
    if iso_used:
        if isdir(iso_path):
            print('Removing: {}'.format(iso_path))
            remove_tree(iso_path)

    # It should be possible to download the iso with a fake user agent (linux)
    #https://software-download.microsoft.com/db/Win10_20H2_French_x64.iso?t=1fdaf7f9-30d3-45f9-857d-d86758816446&e=1605024730&h=20fde675468d33f596d6efb4a2ad3b52
    #https://software-download.microsoft.com/db/Win10_20H2_French_x64.iso?t=86cc2bb9-2e99-4058-9e6e-8a8451b22032&e=1605025110&h=60eb4740cf1fc8a1c670a9ba3a567dbd
    # Good luck in JavaScipt
    #view-source:https://www.microsoft.com/software-download/windows10ISO

    # Using MediaCreationTool for generating an ISO
    if isfile(bin_name) and not iso_used:
        print("If you are prompted for a product key, you can try to use a Windows 10 KMS client key foundable here: https://docs.microsoft.com/windows-server/get-started/kmsclientkeys")
        run('{} /Eula Accept /MediaLangCode {} /Retail /MediaArch {} /MediaEdition {}'.format(bin_name,Lang,Arch,Edition),timeout=5000)
        messagebox(control.package, "You can now make a copy of the ISO before the extraction.")

    # Extracting ISO
    iso_in_dir = glob.glob('*.iso')[0]
    print('Extracting: ' + iso_in_dir)
    unzip_with_7zip(iso_in_dir, iso_path)
    remove_file(iso_in_dir)

    # Getting version from the ISO setup.exe
    #version = Version(get_file_properties(setup_path)['ProductVersion'],3)
    # Forced version (since the ISO setup.exe one is incorrect)
    version = upgrade_windows_version_to

    # Changing version of the package
    if Version(version) > control.get_software_version():
        print("Software version updated from: %s to: %s" % (control.get_software_version(), Version(version)))
        result = True
    control.version = '%s-%s' % (Version(version), control.version.split('-', 1)[-1])
    #control.set_software_version(Version(version))
    control.save_control_to_wapt()

    # Changing locale of the package
    control.locale = Lang.split('-')[0].lower()
    control.save_control_to_wapt()
    print('Changing locale to: %s in WAPT\\control' % control.locale)

    # Changing architecture of the package
    control.architecture = Arch
    control.save_control_to_wapt()
    print('Changing architecture to: %s in WAPT\\control' % control.architecture)

    # Validating update-package-sources
    return result




def get_proxies():
    r"""Return system proxy with the urllib python library

    >>> get_proxies()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_proxies_from_wapt_console():
    r"""Return proxy information from the current user WAPT console

    >>> get_proxies_from_wapt_console()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    proxies = {}
    if platform.system() == 'Windows':
        waptconsole_ini_path = makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini')
    else:
        waptconsole_ini_path = makepath(user_home_directory(), '.config', 'waptconsole', 'waptconsole.ini')
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, 'global', 'http_proxy')
        if proxy_wapt:
            proxies = {'http': proxy_wapt, 'https': proxy_wapt}
    return proxies


def unzip_with_7zip(filename, target=None, filenames=[], recursive=True, extract_with_full_paths=True):
    r"""Extract the files from an archive zipfile with patterns in filenames to target directory

    Args:
        filename (str): path to zipfile. (can be relative to temporary unzip location of package)
        target (str): zip content to target dir location (dir will be created if needed). Default: zip content to current location
        filenames (str or list of str): list of filenames / glob patterns (path sep is normally a slash)
        recursive (bool): looking or not for filenames recursively
        extract_with_full_paths (bool): keeping or not the subfolders of the archive as is


    Returns:
        None

    .. versionadded:: 2.0

    """

    if not isinstance(filenames, list):
        filenames = [filenames]

    if isfile(makepath(programfiles, '7-Zip', '7z.exe')):
        sevenzip_path = makepath(programfiles, '7-Zip', '7z.exe')
    elif isfile(makepath(programfiles32, '7-Zip', '7z.exe')):
        sevenzip_path = makepath(programfiles32, '7-Zip', '7z.exe')
    else:
        error("7zip must be installed on this pc to use this function")

    if not filenames:
        if extract_with_full_paths:
            run(r'"%s" x "%s" %s %s -aoa' % (sevenzip_path, filename, '' if not target else '-o"%s"' % target, '' if not recursive else '-r'))
        else:
            run(r'"%s" e "%s" %s %s -aoa' % (sevenzip_path, filename, '' if not target else '-o"%s"' % target, '' if not recursive else '-r'))
    else:
        for extract in filenames:
            if extract_with_full_paths:
                run(r'"%s" x "%s" %s "%s" %s -aoa' % (sevenzip_path, filename, '' if not target else '-o"%s"' % target, extract, '' if not recursive else '-r'))
            else:
                run(r'"%s" e "%s" %s "%s" %s -aoa' % (sevenzip_path, filename, '' if not target else '-o"%s"' % target, extract, '' if not recursive else '-r'))


										

  Changelog 



Changelog software url : https://docs.microsoft.com/windows/release-health/



No changelog.txt.
									
  manifest.sha256