Jump to content

Recommended Posts

Automatique upgrade to Windows 11

Put in the same Directory your *.ISO file and the Skip_TPM_Check_on_Dynamic_Update.cmd from MediaCreationTool.bat. ISO can be made from uupdump.net

Compile with AutoIt and run. W11 22h2 will be deployed.

Have fun.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=Auto Upgrade W11
#AutoIt3Wrapper_Res_ProductName=Auto Upgrade W11
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

    AutoIt Version:
    Author:         Cramaboule
    Date:           December 2022

    Script Function: Auto Upgrade to W11

    Source: https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-setup-command-line-options?view=windows-11

    Bug:    Not known

    To do:

    V1.0.1.1    14.02.2022:
                Fixed: Mounting ISO with spaces in path in now fixed.
                Changed: Alwayas unzipp and always install TPM with the 'install' argument.
                Fixed: Small bugs
    V1.0.1.0    17.01.2023:
                Changed: Get drive letter by loop!
    V1.0.0.1    29.12.2022:
                Changed: Get drive letter from powershell
                Changed: Check if zip is already expended
                Changed: Check if iso file is mounted
                Changed: Display message
    V1.0.0.0    28.12.2022:
                Inital relase

#ce ----------------------------------------------------------------------------

#include <Array.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>

$sIsoFile = @ScriptDir & '\22621.963.221202-2359.NI_RELEASE_SVC_PROD1_CLIENTPRO_OEMRET_X64FRE_FR-FR.ISO'
Global $Title = 'Auto Upgrade W11'
Global $font = 'Segoe UI Light', $sFinalMessage
SplashTextOn($Title, '', 300, 400, -1, -1, $DLG_TEXTLEFT, $font, 14, 400)
_Splash('Checking free space')
$iFreeSpace = DriveSpaceFree(@HomeDrive & "\") ; usualy C:\
If Round(Number($iFreeSpace) / 1024, 2) < 15 Then
    If (MsgBox($MB_ICONERROR + $MB_YESNO, 'No free space', 'You must have at least 15 Go free on your hard disk.' & @CRLF & 'You have: ' & Round(Number($iFreeSpace) / 1024, 2) & ' Go' & @CRLF & @CRLF & 'Would you like to continue ?') = $IDNO) Then Exit

_Splash('Unzipping zip file')
RunWait(@ComSpec & ' /c ' & 'powershell -command "Expand-Archive -Path W11bypassTPM.zip -Force"')

_Splash('Skipping TPM')
RunWait(@ComSpec & ' /c ' & 'W11bypassTPM\MediaCreationTool.bat-main\bypass11\Skip_TPM_Check_on_Dynamic_Update.cmd install')

_Splash('Mounting ISO')
If Not (_GetDriveLetter()) Then
    RunWait(@ComSpec & ' /c ' & 'powershell -command "Mount-DiskImage -ImagePath \"' & $sIsoFile & '\""')
$sDrive = _GetDriveLetter()

If $sDrive Then
    _Splash('Running setup.exe')
    Run(@ComSpec & ' /c ' & 'start ' & $sDrive & ':\setup.exe /auto upgrade /dynamicupdate disable /eula accept')
    Sleep(10000) ; 10 secondes
    _Splash('Error: No Setup found')
    MsgBox($MB_TOPMOST + $MB_ICONERROR, 'Error', 'No "Setup.exe" found' & @CRLF & 'Error: ' & $sDrive)

Func _GetDriveLetter()
    Local $sOutput = ''
    For $i = 1 To 26
        ; A = 65
        $Letter = Chr($i + 64)
        If FileExists($Letter & ':\sources\install.wim') Then
            Return $Letter
    Return False
EndFunc   ;==>_GetDriveLetter

Func _Splash($message)
    $sFinalMessage = $sFinalMessage & $message & @CRLF
    ControlSetText($Title, "", "Static1", $sFinalMessage)
EndFunc   ;==>_Splash


Edited by cramaboule
Remove sensitiv data
Link to post
Share on other sites


Hummmmm. Honestlely I do not know. 

 * UUP dump - Download UUP files from Windows Update servers with ease. *  that's what they say on their website.
If 'skip TPM' is against MS rules then feel free to remove the post.

I havn't think about that!


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By cramaboule
      I am %*&%*+$ with the Windows Updates every 2 weeks or so... And my people who never do their updates...
      So... fortunately, I have AutoIt and my brain (lol)
      Basically my approach is the following: I push the new KB's and users will receive a notification when they want to do their updates
      1. Reboot, install and shutdown at the end of the day
      2. Reboot later
      3. Reboot now
      As I am in Switzerland I made it in 3 languages: French, German, English (thank to Brett Francis (BrettF))
      The thing behind: I download the msu file from the Windows Catalog. I put it on my server where they can download it (internally and externally). I made a dat file (ini file) with the new build of Win 10/11 and the KB file name. I put as well the file time of the exe. Thus it can do an automatique update of my AutoIt prg itself.
      My prg will download the dat file, test the hash, and do the updates if necessary, then display the gui.
      There is a task scheduler that runs my prg.
      You 'just' need to run once on the PC and it will deploy by itself. (I push it through a sort of Remote Management software, that run under 'SYSTEM')
      What you need to change for you:
      - In Write-datFile.au3: 
      Line 17: Your own server (for me it is an UNC path)
      $sServerFile = '\\Path\to\myWEB\SERVER\ManageWU.dat' - In Shutdown.au3:
      Line 36: Your own Task Scheduler folder:
      Local $iPID = RunWait(@ComSpec & " /c " & 'SCHTASKS /Delete /TN "FOLDER\shutdown" /F', @SystemDir, @SW_HIDE) - Your Logo !!! (logo.bmp)

      - In ManageWU.au3:
      Line 12: Your own server (for me it is an UNC path)
      #AutoIt3Wrapper_Run_After=copy "%out%" "\\Path\to\myWEB\SERVER\" Line 102: Your external web adresse:
      Global $sRootDwl = 'https://path/to/myWEB/SERVER' Line 294, 494, 513 : Your own Task Scheduler folder:
      Local $iPID = RunWait(@ComSpec & ' /c SCHTASKS /create /TN "FOLDER\ManageWU" /xml "' & $rootdir & '\ScheduleManageWU.xml" /F', @SystemDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) Run('SCHTASKS /create /tn "FOLDER\Shutdown" /tr "' & $rootdir & '\Shutdown.exe" /sc ONSTART /RU "SYSTEM" /RL "HIGHEST" /F') Run('SCHTASKS /create /tn "FOLDER\Shutdown" /tr "' & $rootdir & '\Shutdown.exe" /sc ONSTART /RU "SYSTEM" /RL "HIGHEST" /F') FileInstall are in 283-288: just compile other programs and make sure they are in the right place...
      FileInstall('logo.bmp', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('.\LngFiles\FRENCH.XML', $rootdir & '\LngFiles\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('.\LngFiles\ENGLISH.XML', $rootdir & '\LngFiles\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('.\LngFiles\GERMAN.XML', $rootdir & '\LngFiles\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('ScheduleManageWU.xml', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) FileInstall('Shutdown.exe', $rootdir & '\', $FC_OVERWRITE + $FC_CREATEPATH) I believe that's all !

      Comments are welcome
      Edit: typo

      ManageWU-IE.zip 60 downloads
    • By r2du-soft
      I am using Windows 11
      on Windows 11 when i use  @OSVersion, Autoit return WIN_10
      how can detect and return WIN_11 with @OSVersion?
    • By DesireDenied
      Hey guys,
      I having some hard times getting false-positive, probably because I am trying to execute my AutoUpdater.
      Here is my code:
      Global $iUpdateTimer = 0 While 1 checkUpdates(10) WEnd Func checkUpdates($iDelay = 10) $iDelay = $iDelay * 1000 * 60 If TimerDiff($iUpdateTimer) > $iDelay Then ConsoleWrite('checking for updates...' & @CRLF) $iUpdateTimer = TimerInit() If FileExists('AutoUpdater.exe') Then ShellExecuteWait('AutoUpdater.exe') ; this is the line which cause my problem EndIf EndFunc And AutoUpdater code:
      #include <MsgBoxConstants.au3> #include <FileConstants.au3> Global $sExecName = 'test.exe' Global $sUpdatePath = @UserProfileDir &'\desktop\AnyAppName\update\'& $sExecName Global $sUserPath = @UserProfileDir &'\desktop\AnyAppName\'& $sExecName Global $sCopyright = 'someUniqueStringHere' If Not FileExists($sUpdatePath) Then Exit 0 If FileGetVersion($sUpdatePath, $FV_LEGALCOPYRIGHT) <> $sCopyright Then Exit 0 ; checking if we really want to update and execute the file If FileGetVersion($sUpdatePath) > FileGetVersion($sUserPath) Then $iResponse = MsgBox(BitOR($MB_YESNO, $MB_ICONQUESTION),'AnyAppName', 'There is an update available, would you like to update?') If $iResponse == $IDYES Then If ProcessExists($sExecName) Then ProcessClose($sExecName) Sleep(500) EndIf FileCopy($sUpdatePath, $sUserPath, $FC_OVERWRITE) Sleep(3000) ShellExecute($sUserPath) Exit 1 EndIf EndIf Exit 0 I am not trying to ask, why is my code is getting recognized as false-positive, because this is quite obvious, but is there any other way to get things done without running external process?

    • By Simpel
      Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData.
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank?
      Regards, Conrad
    • By Vijaya7890
      I am trying to add a record in Binary Table in an MSI file.
      As Binary table has two fields/columns Name &Data , I am giving any string for Name(column 1) and streaming binary data from a VBS file into Data(column 2) .
      I have tried with VB script and it is working fine,
      Here is the VB Script file
      Dim Installer Dim Database Dim View Dim Record Dim query query="INSERT INTO `Binary` (`Name`, `Data`) VALUES ('NewBlob', ?)" Set Installer = CreateObject("WindowsInstaller.Installer") Set Record = Installer.CreateRecord(1) Record.SetStream 1, "C:\Users\Admin\Desktop\coder\CA_Test.vbs" Set Database = Installer.OpenDatabase("C:\Users\Admin\Desktop\7z920.msi", 1) Set View = Database.OpenView(query) View.Execute Record Database.Commit when i tried the same thing in autoit it is not working and it is not giving any syntax error.
      AutoIt file: 
      #include <File.au3> $idVarInput_CAName="CA_Test" $filepath="C:\Users\Admin\Desktop\coder\CA_Test.vbs" $idVarInput_MSIPath="C:\Users\Admin\Desktop\7z920.msi" $value="?" Local $Query = "INSERT INTO Binary(Name,Data) VALUES('" & $idVarInput_CAName & "','" & $value & "')" $oInstaller = ObjCreate("WindowsInstaller.Installer") $oRec=$oInstaller.CreateRecord(1) $r=$oRec.SetStream(1,$filepath) $oDB = $oInstaller.OpenDataBase($idVarInput_MSIPath,1) $oView = $oDB.OpenView($Query) $oView.Execute($oRec) $oDB.commit() Please Help!
  • Create New...