tis-reinstall-windows-with-wads icon

Reinstall Windows with WADS

Silent install package for Reinstall Windows with WADS

25-6

tis-reinstall-windows-with-wads

Reinstall Windows with WADS

The machine will get ready for deployment

To prevent you from unintentional OS deployments, there are 2 safety features:

  • package: tis-reinstall-windows-with-wads
  • name: Reinstall Windows with WADS
  • version: 25-6
  • categories: System and network
  • maintainer: Simon Fonteneau
  • locale: all
  • target_os: windows
  • architecture: x64
  • signature_date:
  • size: 7.98 Ko

package           : tis-reinstall-windows-with-wads
version           : 25-6
architecture      : x64
section           : base
priority          : optional
name              : Reinstall Windows with WADS
categories        : System and network
maintainer        : Simon Fonteneau
description       : Warning, Installing this package will reinstall Windows. Please read readme.md.
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.3
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : Attention, l'installation de ce paquet réinstallera Windows. Veuillez lire le fichier readme.md.
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : 3a0a4786-cd27-4277-8f2e-4be5b17b1213
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : f2c39f33ff7df4cf6f12f1050a3653d32cc3a6351fc5c58bd565d386340f2cf8
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-06-24T09:00:41.000000
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
signature         : Fag4xtVJ76aog01Ed2waGfzO5paJeVx1xndy11NxfIwC+08l/w7w5+R+cdQIh+xI0Gr79xo4WXJcATkNEtJR3ZeeZtLIW/St+1GkyeMIxslfTn610Xj284ig5Rn5R7nOPYgk4tVgBE8GW/nkghzdmEFiadtUrgeO0kOfKgttmNo4JnK5MPHw1q965gRQ+3rFV2mOxMOJkneqLypWBQ/5VSULHHN8TKCcptj6p2YuOdarMdhwEvVZ7rvPfe6x44SDJ0gAJbIk6ZTZsmcY+CVWXOPZ11Meoohw2n243nsSONgc1+YZL4kGbCg9a0RC2kX+w6Jn4tLiP5Ewn058Xh18kA==

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

name_menu = "Wads Deploy"
guid = "{2bdabb2b-eb21-11ec-ba0b-c85b76537da2}"
loc_folder = "wadswinpe"
loc_systemdrive = systemdrive()
full_loc_folder = makepath(loc_systemdrive, loc_folder)


def install():

    if params.get("install_with_luti", False):
        return "OK"

    error("This package is protected against accidental launches. Please remove this line if you really want to install a new operating system")

    if not isdir(full_loc_folder):
        mkdirs(full_loc_folder)

    if not isfile("boot.sdi"):
        update_package(from_setup=True)

    filecopyto("boot.sdi", makepath(full_loc_folder, "boot.sdi"))
    filecopyto("boot.wim", makepath(full_loc_folder, "boot.wim"))

    # TODO INTEGRER DANS LE Boot.wim avec 7zip les drivers déjà existant sur la machine on pourrait même extraire les profiles wifi pour faire un déploiement par wifi

    wait_deploy = False

    myip = get_main_ip(WAPT.waptserver.server_url.split('//')[1])[0]

    for net in [u["mac"] for u in networking()]:
        dataipxe = WAPT.waptserver.get("api/v3/get_host_ipxe?mac_address=%s&ip_address=%s" % (net,myip), decode_json=False).decode("utf-8")
        if ("wads/winpe/x64" in dataipxe) and (not "registerwinpe" in dataipxe):
            wait_deploy = True
            break

    if wait_deploy:
        run(r'bcdedit /create {ramdiskoptions} /d "%s"' % name_menu)
        run(r"bcdedit /set {ramdiskoptions} ramdisksdidevice partition=%s" % loc_systemdrive)
        run(r"bcdedit /set {ramdiskoptions} ramdisksdipath \%s\boot.sdi" % loc_folder)
        run(r'bcdedit /create %s /d "%s" /application OSLOADER' % (guid, name_menu))
        run(r"bcdedit /set %s device ramdisk=[%s]\%s\boot.wim,{ramdiskoptions}" % (guid, loc_systemdrive, loc_folder))
        run(r"bcdedit /set %s osdevice ramdisk=[%s]\%s\boot.wim,{ramdiskoptions}" % (guid, loc_systemdrive, loc_folder))
        run(r"bcdedit /set %s systemroot \windows" % guid)
        run(r"bcdedit /set %s winpe yes" % guid)
        run(r"bcdedit /set %s detecthal yes" % guid)
        run(r"bcdedit /displayorder %s /addlast" % guid)
        run(r"bcdedit /default %s" % guid)
        run(r"bcdedit /timeout 5")
        run("shutdown /f /r /t 0")
    else:
        print("Please prepare and start a deployment for this computer in the OS Deployment tab before installing this package")
        print("Skipping Installation")



def update_package(from_setup=None):

    urlserver = WAPT.waptserver.server_url
    old_version = control.get_software_version()

    if not from_setup == True:
        WAPT.waptserver.client_certificate = None
        WAPT.waptserver.client_private_key = None
    with WAPT.waptserver.get_requests_session() as session:
        wget("%s/wads/winpe/x64/media/Boot/boot.sdi" % (urlserver), "boot.sdi", requests_session=session)
        wget("%s/wads/winpe/x64/media/sources/boot.wim" % (urlserver), "boot.wim", requests_session=session)

    if not from_setup == True:
        version = control.version.split("-")[0]
        version_package = str(int(control.version.split("-")[1]) + 1)
        control.version = version + "-" + version_package
        control.save_control_to_wapt()


def uninstall():
    if isdir(full_loc_folder):
        remove_tree(full_loc_folder)

889efc444fa2f381f8e1cf6442539d03aad16b62d5e382f086b8d8dc400875ed : WAPT/README.md
c7175ac9e1e1c686f01e5e0fe7d563c9454838d64e4f1b2f8643c2fde1240d0d : WAPT/README_fr.md
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
349b2f67a5fc0ede392ed27ebec36c0236232ba76baa10d66fc2e79506aa033c : WAPT/control
f2c39f33ff7df4cf6f12f1050a3653d32cc3a6351fc5c58bd565d386340f2cf8 : WAPT/icon.png
480ad93aaeec3d59c17e7e86a55195828341ea3eb7854e925152b1d2f064cbb5 : luti.json
561f28676f2792820b46b7ae918e97950af55e72dfd260689a8aa91fbc72023d : setup.py