tis-windows10-upgrade-template
0-111
Upgrade to the latest version of Windows 10 from Windows 7, 8, 10 and 11 - You must execute the "update-package" and "build-package" for every single necessary language before deploying the package
144 downloads
See build result See VirusTotal scan

Description
- package : tis-windows10-upgrade-template
- name : Windows 10 Upgrade Template
- version : 0-111
- architecture : all
- categories : System and network
- maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
- locale : all
- target_os : windows
- installed_size : 31000000000
- impacted_process : SetupHost
- editor : Microsoft
- licence : Proprietary
- signature_date : 2023-01-02T13:00:06.990366
- Homepage : https://www.microsoft.com/software-download/windows10
- Conflicts :
control
package : tis-windows10-upgrade-template
version : 0-111
architecture : all
section : base
priority : optional
name : Windows 10 Upgrade Template
categories : System and network
maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
description : Upgrade to the latest version of Windows 10 from Windows 7, 8, 10 and 11 - You must execute the "update-package" and "build-package" for every single necessary language before deploying the package
depends :
conflicts : tis-windows10-upgrade-data,tis-windows10-2004-upgrade,tis-windows10-20h2-upgrade
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.2
sources : https://www.microsoft.com/software-download/windows10
installed_size : 31000000000
impacted_process : SetupHost
description_fr : Mise à niveau vers la dernière version de Windows 10 à partir de Windows 7, 8, 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 : Aktualizacja do najnowszej wersji Windows 10 z Windows 7, 8, 10 - musisz wykonać "update-package" i "build-package" dla każdego niezbędnego języka przed wdrożeniem pakietu
description_de : Upgrade auf die neueste Version von Windows 10 von Windows 7, 8, 10 - Sie müssen das "update-package" und "build-package" für jede einzelne benötigte Sprache ausführen, bevor Sie das Paket bereitstellen
description_es : Actualizar a la última versión de Windows 10 desde Windows 7, 8, 10 - Debe ejecutar el "update-package" y "build-package" para cada uno de los idiomas necesarios antes de desplegar el paquete
description_pt : Actualização para a última versão do Windows 10 a partir do Windows 7, 8, 10 - Deve executar o "update-package" e o "build-package" para cada uma das línguas necessárias antes de implementar o pacote
description_it : Aggiornamento all'ultima versione di Windows 10 da Windows 7, 8, 10 - È necessario eseguire "update-package" e "build-package" per ogni singola lingua necessaria prima di distribuire il pacchetto
description_nl : Upgrade naar de laatste versie van Windows 10 vanuit Windows 7, 8, 10 - U moet de "update-package" en "build-package" uitvoeren voor elke noodzakelijke taal voordat u het pakket implementeert
description_ru : Обновление до последней версии Windows 10 с Windows 7, 8, 10 - необходимо выполнить команды "update-package" и "build-package" для каждого необходимого языка перед развертыванием пакета
audit_schedule :
editor : Microsoft
keywords :
licence : Proprietary
homepage : https://www.microsoft.com/software-download/windows10
package_uuid : 87119c3c-4bdf-439e-a343-6c993b405b5e
valid_from :
valid_until :
forced_install_on :
changelog : https://docs.microsoft.com/windows/release-health/
min_os_version : 6.1
max_os_version :
icon_sha256sum : 0f0215b9e420749ac9eb93b5bf0ef17810011c14427248e1b0d72e6699279534
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature : kEg2yngXQ77TuviNgbEZ4eJaEikJyq+Dy+jEOO+KpFXsSsCtrCjo7edraGkswzR1TYT1Gzej5Pwgl49VMkV9aURAulhL26XLT2jHQyzq4BunvcifUMp81tW/NLY0pGUzIE5eyQUYJntp5Gxz3qjMC/ey/fQ/LpDiqCc7qgm5yUSqx5UC9ADJnLF56Qjr7RnbgJ57GOu1ivjFrOGIoZa9KMvDNPN0wEYY0gQtQghPlFeh2wfj3NsuX7t98TXA6EtVwvd4dj0hZwCD0eezWnndb13l2vFxbNEJlTSqoDwLB63Z99t2htQBOYGz/U+4Ur4SWZJqpj6L2e/C7vqkq2/3YA==
signature_date : 2023-01-02T13:00:06.990366
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
Setup.py
# -*- coding: utf-8 -*-
from setuphelpers import *
import time
r"""
Sources:
https://docs.microsoft.com/archive/blogs/home_is_where_i_lay_my_head/windows-10-setup-command-line-switches
https://docs.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-command-line-options
https://www.prajwaldesai.com/windows-10-upgrade-setup-failed-with-exit-code-0xc1900200/
https://www.tomshardware.com/how-to/bypass-windows-11-tpm-requirement
https://docs.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-command-line-options?view=windows-11#compat
https://docs.microsoft.com/windows-server/administration/windows-commands/cleanmgr
Infos:
Forced install will automatically reboot the PC
This package can be updated graphically
"""
DynamicUpdate = False
upgrade_path = makepath(systemdrive, "WindowsUpgrade")
upgrade_logs_path = makepath(systemdrive, "WindowsUpgradeLogs")
windows_old_path = makepath(systemdrive, "Windows.old")
cleanmgr_timeout = 660
def install():
# Declaring local variables
package_version = control.get_software_version()
iso_path = makepath(basedir, "iso")
cleanmgr_keys = [
"Active Setup Temp Folders",
"BranchCache",
"Content Indexer Cleaner",
"D3D Shader Cache",
"Delivery Optimization Files",
"Device Driver Packages",
"Diagnostic Data Viewer database files",
"Downloaded Program Files",
"DownloadsFolder",
"Internet Cache Files",
"Language Pack",
"Offline Pages Files",
"Old ChkDsk Files",
"Previous Installations",
"Recycle Bin",
"RetailDemo Offline Content",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Temporary Sync Files",
"Thumbnail Cache",
"Update Cleanup",
"Upgrade Discarded Files",
"User file versions",
"Windows Defender",
"Windows Error Reporting Files",
"Windows ESD installation files",
"Windows Upgrade Log Files",
]
# Checking if Windows must be upgraded
if Version(windows_version(), 3) < Version(package_version, 3):
# Trying to remove previous version of Windows if needed
if isdir(windows_old_path) or isdir(r"C:\$Windows.~WS"):
key_path = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
key_value = r"StateFlags0042"
for key in cleanmgr_keys:
if "Upgrade Discarded Files" in key or "Previous Installations" in key:
registry_set(HKEY_LOCAL_MACHINE, makepath(key_path, key), key_value, 2)
else:
registry_set(HKEY_LOCAL_MACHINE, makepath(key_path, key), key_value, 0)
print("Removing previous version of Windows")
cleanmgr_cmd = "cleanmgr /verylowdisk /sagerun:42"
run_notfatal(cleanmgr_cmd, timeout=cleanmgr_timeout) # seems to timeout on missing user graphical interface
# run_powershell(r"Start-Process -FilePath CleanMgr.exe -ArgumentList '/sagerun:42 /verylowdisk' -WindowStyle Hidden -Wait")
print("Waiting for custom CleanMgr")
max_loop = cleanmgr_timeout
while isrunning("cleanmgr"):
loop = 0
loop += 10
if loop > max_loop:
print("CleanMgr timed out after %s seconds, trying to continue" % max_loop)
print('If the upgrade fail, please run: "%s" manually as asministrator on the PC' % cleanmgr_cmd)
time.sleep(10)
print("CleanMgr is running since %s seconds" % loop)
print("CleanMgr finished")
# Move iso
if isdir(upgrade_path):
remove_tree(upgrade_path)
os.rename(iso_path, upgrade_path)
if not isdir(upgrade_logs_path):
mkdirs(upgrade_logs_path)
# Upgrading Windows if needed
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:
# Changing cmd options
additionnal_cmd = ""
if DynamicUpdate:
additionnal_cmd = additionnal_cmd + " /dynamicupdate enable"
else:
additionnal_cmd = additionnal_cmd + " /dynamicupdate disable"
if force:
try:
print("Force Upgrading Windows from version: %s to Windows version: %s" % (windows_version(), package_version))
run(
rf'"{makepath(upgrade_path, "setup.exe")}" /auto upgrade /quiet /telemetry disable /showoobe none /copylogs "{makepath(upgrade_logs_path, "win11_upgrade_logs")}" {additionnal_cmd}',
timeout=5000,
)
except Exception as error_force_upgrade:
error(error_force_upgrade)
else:
additionnal_cmd = additionnal_cmd + " /noreboot"
try:
print("Upgrading Windows from version: %s to Windows version: %s" % (windows_version(), package_version))
run(
rf'"{makepath(upgrade_path, "setup.exe")}" /auto upgrade /quiet /telemetry disable /showoobe none /copylogs "{makepath(upgrade_logs_path, "win11_upgrade_logs")}" {additionnal_cmd}',
timeout=5000,
)
except Exception as error_upgrade:
error(error_upgrade)
else:
error("%s do not exist, please reinstall this package" % upgrade_path)
else:
print("This PC is already up-to-date on Windows version: %s" % windows_version())
def uninstall():
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():
if Version(windows_version()) < Version(control.get_software_version()):
if isrunning("SetupHost"):
print("WARNING: Windows upgrade is running...")
return "WARNING"
elif is_pending_reboot():
print("WARNING: Please reboot this PC to finalize the upgrade")
return "WARNING"
else:
print("ERROR: Windows upgrade failed")
return "ERROR"
else:
print("OK: This PC is now up-to-date on Windows version: %s" % windows_version())
print("Cleaning up since the upgrade was successful...")
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)
return "OK"
update_package.py
# -*- coding: utf-8 -*-
from setuphelpers import *
import waptguihelper
import subprocess
def update_package():
# Declaring local variables
package_updated = False
iso_path = makepath(basedir, "iso")
setup_path = makepath(iso_path, "setup.exe")
iso_present = False
iso_extracted = False
iso_copy_path = None
iso_to_download = False
keep_extracted_iso = False
keep_current_iso = False
lang_dict = {
"fr": "French",
"en": "English",
"pl": "Polish",
"de": "German",
"es": "Spanish",
"pt": "Portuguese",
"it": "Italian",
"nl": "Dutch",
"ru": "Russian",
"all": "Others",
}
lang_list = []
for entry in lang_dict:
lang_list.append({"short name": entry, "long name": lang_dict[entry]})
# Detect ISO if placed
for iso_in_dir in glob.glob("*.iso"):
if isfile(iso_in_dir):
iso_present = True
# Detect ISO if already extracted
if isfile(setup_path):
iso_extracted = True
if iso_present:
keep_iso_present_question = waptguihelper.message_dialog("ISO found", f"Do you want to keep: {iso_in_dir}?", waptguihelper.ID_YES)
if keep_iso_present_question == waptguihelper.ID_YES:
keep_current_iso = True
if iso_extracted:
keep_iso_extracted_question = waptguihelper.message_dialog("An ISO is already extracted", "Do you want to keep it?", waptguihelper.ID_YES)
if keep_iso_extracted_question == waptguihelper.ID_YES:
keep_extracted_iso = True
if keep_current_iso and keep_extracted_iso:
keep_only_one_question = waptguihelper.grid_dialog(
"Please select only one", [{"keep :": iso_in_dir}, {"keep :": "iso already extracted"}], waptguihelper.GRT_SELECTED
)
if "extracted" in keep_only_one_question[0]["keep :"]:
keep_current_iso = False
else:
keep_extracted_iso = False
if not keep_extracted_iso:
if not iso_present:
iso_absent_question = waptguihelper.message_dialog(
"No ISO detected", "Do you want to download Windows ISO from Microsoft's servers?\nClick No to use your own ISO", waptguihelper.ID_YES
)
if iso_absent_question == waptguihelper.ID_YES:
iso_to_download = True
if iso_to_download:
# Download from browser
try:
if isdir(makepath(programfiles32, "Google", "Chrome", "Application")):
chrome_app_path = makepath(programfiles32, "Google", "Chrome", "Application")
else:
chrome_app_path = makepath(programfiles, "Google", "Chrome", "Application")
chrome_bin_path = makepath(chrome_app_path, "chrome.exe")
waptguihelper.message_dialog(
"Chrome will open with a custom user-agent",
'Select "Download Windows 10 Disk Image (ISO)" => "Windows 10 (multi-edition ISO) => then your language. When the download is finished, please close the opened Chrome',
)
cmd_browser = rf'"{chrome_bin_path}" --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" --user-data-dir=%tmp%\chrome_tmp "{control.sources}"'
subprocess.Popen(cmd_browser,shell=True, start_new_session=True)
waptguihelper.message_dialog("Waiting for download","Click OK when the download is complete", waptguihelper.ID_OK)
except:
error(cmd_browser)
# Copy to pkg
if not keep_current_iso and not iso_present and not keep_extracted_iso:
# Cleanup ISO files
for iso_in_dir in glob.glob("*.iso"):
remove_file(iso_in_dir)
iso_copy_path = waptguihelper.filename_dialog("Please provide the Windows ISO to copy in this package", "", "", "ISO Files|*.iso")
print("Copying: " + iso_copy_path)
filecopyto(iso_copy_path, basedir)
# Extracting ISO
if not keep_extracted_iso:
# Cleanup ISO dir
if isdir(iso_path):
remove_tree(iso_path)
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 = ".".join(get_file_properties(setup_path)["ProductVersion"].split(".")[:3])
if version == "10.0.19041":
version = waptguihelper.input_dialog(control.package, "Please provide the correct version number of this ISO", version)
# 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)))
package_updated = True
control.set_software_version(version)
control.save_control_to_wapt()
# Changing locale of the package
lang_short = waptguihelper.grid_dialog("Please select a language", lang_list, waptguihelper.GRT_SELECTED)[0]["short name"]
# Updating pkg infos
if "-template" in control.package:
package_name = waptguihelper.input_dialog(control.package, "You can redefine the package name", control.package.split("-template")[0])
control.package = package_name
if " Template" in control.name:
control.name = control.name.split(" Template")[0]
print("Changing package name to: %s" % package_name)
if "all" in control.architecture:
package_architecture = waptguihelper.combo_dialog(control.package, "Select architecture", ["x64", "x86"])
control.architecture = package_architecture
print("Changing arch to: %s" % package_architecture)
control.locale = lang_short
control.save_control_to_wapt()
print("Changing locale to: %s in WAPT\\control" % control.locale)
# Validating update-package-sources
return package_updated
19e2a5f4ed9aae837206967c59733b91dc93d2f7e6c4a170c42ec24e8e2f7e48 : setup.py
3df872ed416bbd7aaa91f824ada0965b42b3bece4bbe0d63b5d14aa1925a8e71 : update_package.py
0f0215b9e420749ac9eb93b5bf0ef17810011c14427248e1b0d72e6699279534 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
5ff40c71cff2b280957f72a62f3d39f38f5efe99dc15e5dd6e9dada7d951de40 : WAPT/changelog.txt
943036ae5bb1e70e4f7b7ad2301488728e93e1426abdede5e59cbf7b44633f0f : luti.json
8d6a1ace59d72de3a7831b6a345cc37ead87245db0becc5fb16e03fa03800a09 : WAPT/control
Changelog
Changelog software url: https://docs.microsoft.com/windows/release-health/
0-110
Rebasing code on tis-windows11-upgrade-template
10.0.19044-99
Adding WARNING: Please reboot this PC to finalize the upgrade
10.0.19044-98
no longer force cleanmgr since its not reliable on system account
print cleanmgr command for manual debug if needed
reducing delay cleanmgr timeout to 660sec and no longer return error if crashed
10.0.19044-94
fix cleanmgr
force cleanmgr "Previous Installations" on upgrade
moving code
10.0.19044-93
Improved cleanmgr
10.0.19044-92
Move iso to save space
min_wapt_version : 2.1
WindowsVersions().Windows10v21H2